Copyright | (c) Donnacha Oisín Kidney 2020 |
---|---|
License | Apache |
Maintainer | mail@doisinkidney.com |
Stability | experimental |
Portability | ghc |
Safe Haskell | None |
Language | Haskell2010 |
WARNING
This module is considered internal.
The Package Versioning Policy does not apply.
This contents of this module may change in any way whatsoever and without any warning between minor versions of this package.
Authors importing this module are expected to track development closely.
Synopsis
- data Star a
- data Plus a = (:-) {}
- pattern (:*) :: a -> Star a -> Star a
- pattern (:+) :: a -> Plus a -> Plus a
- pattern One :: a -> Plus a
- (*<>+) :: Star a -> Plus a -> Plus a
- (+<>*) :: Plus a -> Star a -> Plus a
- merge :: (a -> a -> Ordering) -> Star a -> Star a -> Star a
- mergel :: (a -> a -> Ordering) -> Plus a -> Star a -> Plus a
- merger :: (a -> a -> Ordering) -> Star a -> Plus a -> Plus a
- mergelr :: (a -> a -> Ordering) -> Plus a -> Plus a -> Plus a
- treeFoldMap :: (a -> b) -> (b -> b -> b) -> Plus a -> b
- prescanlPlus :: (b -> a -> b) -> b -> Plus a -> Plus b
- prescanlStar :: (b -> a -> b) -> b -> Star a -> Star b
- scanl :: (b -> a -> b) -> b -> Star a -> Plus b
- scanr :: Foldable f => (a -> b -> b) -> b -> f a -> Plus b
- filter :: Foldable f => (a -> Bool) -> f a -> Star a
- takeStar :: Int -> Star a -> Star a
- takePlus :: Int -> Plus a -> Star a
- indexPlus :: Plus a -> Int -> a
- indexStar :: Star a -> Int -> a
Documentation
A list, based on the Kleene star.
This type is isomorphic to Haskell's standard []
type, so it can be used
in the same way.
Instances
Monad Star Source # | |
Functor Star Source # | |
MonadFix Star Source # | |
Defined in Data.List.Kleene.Internal | |
Applicative Star Source # | |
Foldable Star Source # | |
Defined in Data.List.Kleene.Internal fold :: Monoid m => Star m -> m # foldMap :: Monoid m => (a -> m) -> Star a -> m # foldMap' :: Monoid m => (a -> m) -> Star a -> m # foldr :: (a -> b -> b) -> b -> Star a -> b # foldr' :: (a -> b -> b) -> b -> Star a -> b # foldl :: (b -> a -> b) -> b -> Star a -> b # foldl' :: (b -> a -> b) -> b -> Star a -> b # foldr1 :: (a -> a -> a) -> Star a -> a # foldl1 :: (a -> a -> a) -> Star a -> a # elem :: Eq a => a -> Star a -> Bool # maximum :: Ord a => Star a -> a # | |
Traversable Star Source # | |
Eq1 Star Source # | |
Ord1 Star Source # | |
Defined in Data.List.Kleene.Internal | |
Show1 Star Source # | |
MonadZip Star Source # | |
Alternative Star Source # | |
MonadPlus Star Source # | |
IsList (Star a) Source # | |
Eq a => Eq (Star a) Source # | |
Data a => Data (Star a) Source # | |
Defined in Data.List.Kleene.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Star a -> c (Star a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Star a) # toConstr :: Star a -> Constr # dataTypeOf :: Star a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Star a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Star a)) # gmapT :: (forall b. Data b => b -> b) -> Star a -> Star a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Star a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Star a -> r # gmapQ :: (forall d. Data d => d -> u) -> Star a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Star a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Star a -> m (Star a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Star a -> m (Star a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Star a -> m (Star a) # | |
Ord a => Ord (Star a) Source # | |
Show a => Show (Star a) Source # | |
Generic (Star a) Source # | |
Semigroup (Star a) Source # | |
Monoid (Star a) Source # | |
NFData a => NFData (Star a) Source # | |
Defined in Data.List.Kleene.Internal | |
type Rep (Star a) Source # | |
Defined in Data.List.Kleene.Internal type Rep (Star a) = D1 ('MetaData "Star" "Data.List.Kleene.Internal" "kleene-list-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Nil" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Cons" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Plus a)))) | |
type Item (Star a) Source # | |
Defined in Data.List.Kleene.Internal |
A non-empty list type, based on the Kleene plus.
This type is isomorphic to NonEmpty
type, so it
can be used in the same way.
Instances
Monad Plus Source # | |
Functor Plus Source # | |
MonadFix Plus Source # | |
Defined in Data.List.Kleene.Internal | |
Applicative Plus Source # |
|
Foldable Plus Source # | |
Defined in Data.List.Kleene.Internal fold :: Monoid m => Plus m -> m # foldMap :: Monoid m => (a -> m) -> Plus a -> m # foldMap' :: Monoid m => (a -> m) -> Plus a -> m # foldr :: (a -> b -> b) -> b -> Plus a -> b # foldr' :: (a -> b -> b) -> b -> Plus a -> b # foldl :: (b -> a -> b) -> b -> Plus a -> b # foldl' :: (b -> a -> b) -> b -> Plus a -> b # foldr1 :: (a -> a -> a) -> Plus a -> a # foldl1 :: (a -> a -> a) -> Plus a -> a # elem :: Eq a => a -> Plus a -> Bool # maximum :: Ord a => Plus a -> a # | |
Traversable Plus Source # | |
Eq1 Plus Source # | |
Ord1 Plus Source # | |
Defined in Data.List.Kleene.Internal | |
Show1 Plus Source # | |
MonadZip Plus Source # | |
IsList (Plus a) Source # | |
Eq a => Eq (Plus a) Source # | |
Data a => Data (Plus a) Source # | |
Defined in Data.List.Kleene.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Plus a -> c (Plus a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Plus a) # toConstr :: Plus a -> Constr # dataTypeOf :: Plus a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Plus a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Plus a)) # gmapT :: (forall b. Data b => b -> b) -> Plus a -> Plus a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Plus a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Plus a -> r # gmapQ :: (forall d. Data d => d -> u) -> Plus a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Plus a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Plus a -> m (Plus a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Plus a -> m (Plus a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Plus a -> m (Plus a) # | |
Ord a => Ord (Plus a) Source # | |
Show a => Show (Plus a) Source # | |
Generic (Plus a) Source # | |
Semigroup (Plus a) Source # | |
NFData a => NFData (Plus a) Source # | |
Defined in Data.List.Kleene.Internal | |
type Rep (Plus a) Source # | |
Defined in Data.List.Kleene.Internal type Rep (Plus a) = D1 ('MetaData "Plus" "Data.List.Kleene.Internal" "kleene-list-0.1.0.0-inplace" 'False) (C1 ('MetaCons ":-" 'PrefixI 'True) (S1 ('MetaSel ('Just "head") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just "tail") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Star a)))) | |
type Item (Plus a) Source # | |
Defined in Data.List.Kleene.Internal |
pattern (:*) :: a -> Star a -> Star a infixr 5 Source #
A pattern for building up star lists as cons-lists.
>>>
1 :* 2 :* 3 :* Nil
[1,2,3]
pattern (:+) :: a -> Plus a -> Plus a infixr 5 Source #
A pattern for building up plus lists as cons-lists.
>>>
1 :+ 2 :+ One 3
[1,2,3]
treeFoldMap :: (a -> b) -> (b -> b -> b) -> Plus a -> b Source #
prescanlPlus :: (b -> a -> b) -> b -> Plus a -> Plus b Source #
>>>
prescanlPlus (+) 0 [1,2,3]
[1,3,6]
prescanlStar :: (b -> a -> b) -> b -> Star a -> Star b Source #
>>>
prescanlStar (+) 0 [1,2,3]
[1,3,6]
>>>
:set -XOverloadedLists