Copyright | ⓒ 2022 Anselm Schüler |
---|---|
License | MIT |
Maintainer | mail@anselmschueler.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extensions |
|
The Applicable
class with its operator ($*)
.
You will likely need the FlexibleContexts
extension to use this module’s instances.
Synopsis
- class Applicable f a b | f a -> b where
- ($*) :: f -> a -> b
- newtype ApplyTo a = AppTo {
- unAppTo :: a
- newtype FlapApply f a b = FlApp {
- unFlApp :: f (a -> b)
- newtype BiFlapApply f a b c = BiFlApp {
- unBiFlApp :: f (a -> b) (a -> c)
- newtype ApplyMap a b = AppMap {
- unAppMap :: a -> b
- newtype ApplyAp f a b = AppAp {
- unAppAp :: f (a -> b)
- newtype ApplyBind m a b = AppBind {
- unAppBind :: a -> m b
- newtype GroupAction a = GrpAct {
- unGrpAct :: a
- newtype ChurchBool = ChBool {}
- newtype ChurchNumeral a = ChNum {
- unChNum :: a
- newtype ChurchTuple a b = ChTup {
- unChTup :: (a, b)
Documentation
class Applicable f a b | f a -> b where Source #
A class for types whose values can be applied. Instances are required to be uniquely determined by the applied and applied-to type.
Instances
A wrapper for values. Can be applied to a function, applying the function to the value.
Instances
Foldable ApplyTo Source # | |
Defined in Data.Applicable fold :: Monoid m => ApplyTo m -> m # foldMap :: Monoid m => (a -> m) -> ApplyTo a -> m # foldMap' :: Monoid m => (a -> m) -> ApplyTo a -> m # foldr :: (a -> b -> b) -> b -> ApplyTo a -> b # foldr' :: (a -> b -> b) -> b -> ApplyTo a -> b # foldl :: (b -> a -> b) -> b -> ApplyTo a -> b # foldl' :: (b -> a -> b) -> b -> ApplyTo a -> b # foldr1 :: (a -> a -> a) -> ApplyTo a -> a # foldl1 :: (a -> a -> a) -> ApplyTo a -> a # elem :: Eq a => a -> ApplyTo a -> Bool # maximum :: Ord a => ApplyTo a -> a # minimum :: Ord a => ApplyTo a -> a # | |
Traversable ApplyTo Source # | |
Functor ApplyTo Source # | |
Data a => Data (ApplyTo a) Source # | |
Defined in Data.Applicable gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ApplyTo a -> c (ApplyTo a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ApplyTo a) # toConstr :: ApplyTo a -> Constr # dataTypeOf :: ApplyTo a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ApplyTo a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ApplyTo a)) # gmapT :: (forall b. Data b => b -> b) -> ApplyTo a -> ApplyTo a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ApplyTo a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ApplyTo a -> r # gmapQ :: (forall d. Data d => d -> u) -> ApplyTo a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ApplyTo a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ApplyTo a -> m (ApplyTo a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ApplyTo a -> m (ApplyTo a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ApplyTo a -> m (ApplyTo a) # | |
Generic (ApplyTo a) Source # | |
Ix a => Ix (ApplyTo a) Source # | |
Defined in Data.Applicable range :: (ApplyTo a, ApplyTo a) -> [ApplyTo a] # index :: (ApplyTo a, ApplyTo a) -> ApplyTo a -> Int # unsafeIndex :: (ApplyTo a, ApplyTo a) -> ApplyTo a -> Int # inRange :: (ApplyTo a, ApplyTo a) -> ApplyTo a -> Bool # rangeSize :: (ApplyTo a, ApplyTo a) -> Int # unsafeRangeSize :: (ApplyTo a, ApplyTo a) -> Int # | |
Read a => Read (ApplyTo a) Source # | |
Show a => Show (ApplyTo a) Source # | |
Eq a => Eq (ApplyTo a) Source # | |
Ord a => Ord (ApplyTo a) Source # | |
Defined in Data.Applicable | |
Applicable (ApplyTo a) (a -> b) b Source # | |
Defined in Data.Applicable | |
type Rep (ApplyTo a) Source # | |
Defined in Data.Applicable |
newtype FlapApply f a b Source #
A wrapper for functions wrapped in a Functor
.
Can be applied to a value, fmap
-ing the application over the Functor
.
This nomenclature is borrowed from relude
.
newtype BiFlapApply f a b c Source #
A wrapper for functions wrapped in a Bifunctor
.
Can be applied to a value, bimap
-ing the application over both fields.
Instances
Generic (BiFlapApply f a b c) Source # | |
Defined in Data.Applicable type Rep (BiFlapApply f a b c) :: Type -> Type # from :: BiFlapApply f a b c -> Rep (BiFlapApply f a b c) x # to :: Rep (BiFlapApply f a b c) x -> BiFlapApply f a b c # | |
Bifunctor f => Applicable (BiFlapApply f a b c) a (f b c) Source # | |
Defined in Data.Applicable ($*) :: BiFlapApply f a b c -> a -> f b c Source # | |
type Rep (BiFlapApply f a b c) Source # | |
Defined in Data.Applicable type Rep (BiFlapApply f a b c) = D1 ('MetaData "BiFlapApply" "Data.Applicable" "applicable-0.4.1.0-inplace" 'True) (C1 ('MetaCons "BiFlApp" 'PrefixI 'True) (S1 ('MetaSel ('Just "unBiFlApp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f (a -> b) (a -> c))))) |
newtype ApplyAp f a b Source #
A wrapper for functions in an applicative functor.
Can be applied to an Applicative
functor, (<*>)
-ing it on it.
Instances
Functor f => Functor (ApplyAp f a) Source # | |
Generic (ApplyAp f a b) Source # | |
Applicative f => Applicable (ApplyAp f a b) (f a) (f b) Source # | |
Defined in Data.Applicable | |
type Rep (ApplyAp f a b) Source # | |
Defined in Data.Applicable |
newtype GroupAction a Source #
A wrapper for Semigroup
members, representing the associated group action.
Can be applied to another member, (<>)
-ing them.
Instances
newtype ChurchBool Source #
A wrapper for Bool
s.
When applied to a value, uses the Church encoding of Booleans.
The Church encoding of Booleans is a binary function
that returns its first argument for True
, and its second for False
.
Instances
newtype ChurchNumeral a Source #
A wrapper for natural numbers (approximated by Integral
).
When applied to a value, uses the Church encoding of natural numbers.
Church numerals represent the number _n_ as a function that take another function and repeatedly applies it _n_ times.
Instances
newtype ChurchTuple a b Source #
A wrapper for tuples (,)
.
When applied to a value, uses the Church encoding of tuples.
The Church encoding of tuples applies a function to the values inside a tuple.
Instances
Bifunctor ChurchTuple Source # | |
Defined in Data.Applicable bimap :: (a -> b) -> (c -> d) -> ChurchTuple a c -> ChurchTuple b d # first :: (a -> b) -> ChurchTuple a c -> ChurchTuple b c # second :: (b -> c) -> ChurchTuple a b -> ChurchTuple a c # | |
Foldable (ChurchTuple a) Source # | |
Defined in Data.Applicable fold :: Monoid m => ChurchTuple a m -> m # foldMap :: Monoid m => (a0 -> m) -> ChurchTuple a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> ChurchTuple a a0 -> m # foldr :: (a0 -> b -> b) -> b -> ChurchTuple a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> ChurchTuple a a0 -> b # foldl :: (b -> a0 -> b) -> b -> ChurchTuple a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> ChurchTuple a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> ChurchTuple a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> ChurchTuple a a0 -> a0 # toList :: ChurchTuple a a0 -> [a0] # null :: ChurchTuple a a0 -> Bool # length :: ChurchTuple a a0 -> Int # elem :: Eq a0 => a0 -> ChurchTuple a a0 -> Bool # maximum :: Ord a0 => ChurchTuple a a0 -> a0 # minimum :: Ord a0 => ChurchTuple a a0 -> a0 # sum :: Num a0 => ChurchTuple a a0 -> a0 # product :: Num a0 => ChurchTuple a a0 -> a0 # | |
Traversable (ChurchTuple a) Source # | |
Defined in Data.Applicable traverse :: Applicative f => (a0 -> f b) -> ChurchTuple a a0 -> f (ChurchTuple a b) # sequenceA :: Applicative f => ChurchTuple a (f a0) -> f (ChurchTuple a a0) # mapM :: Monad m => (a0 -> m b) -> ChurchTuple a a0 -> m (ChurchTuple a b) # sequence :: Monad m => ChurchTuple a (m a0) -> m (ChurchTuple a a0) # | |
Functor (ChurchTuple a) Source # | |
Defined in Data.Applicable fmap :: (a0 -> b) -> ChurchTuple a a0 -> ChurchTuple a b # (<$) :: a0 -> ChurchTuple a b -> ChurchTuple a a0 # | |
(Data a, Data b) => Data (ChurchTuple a b) Source # | |
Defined in Data.Applicable gfoldl :: (forall d b0. Data d => c (d -> b0) -> d -> c b0) -> (forall g. g -> c g) -> ChurchTuple a b -> c (ChurchTuple a b) # gunfold :: (forall b0 r. Data b0 => c (b0 -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ChurchTuple a b) # toConstr :: ChurchTuple a b -> Constr # dataTypeOf :: ChurchTuple a b -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ChurchTuple a b)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ChurchTuple a b)) # gmapT :: (forall b0. Data b0 => b0 -> b0) -> ChurchTuple a b -> ChurchTuple a b # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ChurchTuple a b -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ChurchTuple a b -> r # gmapQ :: (forall d. Data d => d -> u) -> ChurchTuple a b -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ChurchTuple a b -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ChurchTuple a b -> m (ChurchTuple a b) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ChurchTuple a b -> m (ChurchTuple a b) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ChurchTuple a b -> m (ChurchTuple a b) # | |
Generic (ChurchTuple a b) Source # | |
Defined in Data.Applicable type Rep (ChurchTuple a b) :: Type -> Type # from :: ChurchTuple a b -> Rep (ChurchTuple a b) x # to :: Rep (ChurchTuple a b) x -> ChurchTuple a b # | |
(Ix a, Ix b) => Ix (ChurchTuple a b) Source # | |
Defined in Data.Applicable range :: (ChurchTuple a b, ChurchTuple a b) -> [ChurchTuple a b] # index :: (ChurchTuple a b, ChurchTuple a b) -> ChurchTuple a b -> Int # unsafeIndex :: (ChurchTuple a b, ChurchTuple a b) -> ChurchTuple a b -> Int # inRange :: (ChurchTuple a b, ChurchTuple a b) -> ChurchTuple a b -> Bool # rangeSize :: (ChurchTuple a b, ChurchTuple a b) -> Int # unsafeRangeSize :: (ChurchTuple a b, ChurchTuple a b) -> Int # | |
(Read a, Read b) => Read (ChurchTuple a b) Source # | |
Defined in Data.Applicable readsPrec :: Int -> ReadS (ChurchTuple a b) # readList :: ReadS [ChurchTuple a b] # readPrec :: ReadPrec (ChurchTuple a b) # readListPrec :: ReadPrec [ChurchTuple a b] # | |
(Show a, Show b) => Show (ChurchTuple a b) Source # | |
Defined in Data.Applicable showsPrec :: Int -> ChurchTuple a b -> ShowS # show :: ChurchTuple a b -> String # showList :: [ChurchTuple a b] -> ShowS # | |
(Eq a, Eq b) => Eq (ChurchTuple a b) Source # | |
Defined in Data.Applicable (==) :: ChurchTuple a b -> ChurchTuple a b -> Bool # (/=) :: ChurchTuple a b -> ChurchTuple a b -> Bool # | |
(Ord a, Ord b) => Ord (ChurchTuple a b) Source # | |
Defined in Data.Applicable compare :: ChurchTuple a b -> ChurchTuple a b -> Ordering # (<) :: ChurchTuple a b -> ChurchTuple a b -> Bool # (<=) :: ChurchTuple a b -> ChurchTuple a b -> Bool # (>) :: ChurchTuple a b -> ChurchTuple a b -> Bool # (>=) :: ChurchTuple a b -> ChurchTuple a b -> Bool # max :: ChurchTuple a b -> ChurchTuple a b -> ChurchTuple a b # min :: ChurchTuple a b -> ChurchTuple a b -> ChurchTuple a b # | |
Applicable (ChurchTuple a b) (a -> b -> c) c Source # | |
Defined in Data.Applicable ($*) :: ChurchTuple a b -> (a -> b -> c) -> c Source # | |
type Rep (ChurchTuple a b) Source # | |
Defined in Data.Applicable type Rep (ChurchTuple a b) = D1 ('MetaData "ChurchTuple" "Data.Applicable" "applicable-0.4.1.0-inplace" 'True) (C1 ('MetaCons "ChTup" 'PrefixI 'True) (S1 ('MetaSel ('Just "unChTup") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a, b)))) |