applicable-0.2.0.0: A class for things that can be applied
Copyrightⓒ 2022 Anselm Schüler
LicenseMIT
Maintainermail@anselmschueler.com
Safe HaskellSafe-Inferred
LanguageHaskell2010
Extensions
  • DeriveFunctor
  • TypeSynonymInstances
  • FlexibleInstances
  • ConstrainedClassMethods
  • MultiParamTypeClasses
  • FunctionalDependencies
  • GeneralizedNewtypeDeriving

Data.Applicable

Description

The Applicable class with its operator ($*). You will likely need the FlexibleContexts extension to use this module’s instances.

Synopsis

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.

Methods

($*) :: f -> a -> b Source #

Apply a value to another value, producing a result.

Instances

Instances details
Applicable ChurchBool a (a -> a) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ChurchBool -> a -> a -> a Source #

Semigroup a => Applicable (GroupAction a) a a Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: GroupAction a -> a -> a Source #

Applicable (ApplyTo a) (a -> b) b Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ApplyTo a -> (a -> b) -> b Source #

Integral a => Applicable (ChurchNumeral a) (a -> a) (a -> a) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ChurchNumeral a -> (a -> a) -> a -> a Source #

Applicable (a -> b) a b Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: (a -> b) -> a -> b Source #

Functor f => Applicable (ApplyMap a b) (f a) (f b) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ApplyMap a b -> f a -> f b Source #

Applicable (ChurchTuple a b) (a -> b -> c) c Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ChurchTuple a b -> (a -> b -> c) -> c Source #

Applicative f => Applicable (ApplyAp f a b) (f a) (f b) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ApplyAp f a b -> f a -> f b Source #

Monad m => Applicable (ApplyBind m a b) (m a) (m b) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ApplyBind m a b -> m a -> m b Source #

newtype ApplyTo a Source #

A wrapper for values. Can be applied to a function (->), applying the function to the inner value.

Constructors

AppTo 

Fields

Instances

Instances details
Functor ApplyTo Source # 
Instance details

Defined in Data.Applicable

Methods

fmap :: (a -> b) -> ApplyTo a -> ApplyTo b #

(<$) :: a -> ApplyTo b -> ApplyTo a #

Read a => Read (ApplyTo a) Source # 
Instance details

Defined in Data.Applicable

Show a => Show (ApplyTo a) Source # 
Instance details

Defined in Data.Applicable

Methods

showsPrec :: Int -> ApplyTo a -> ShowS #

show :: ApplyTo a -> String #

showList :: [ApplyTo a] -> ShowS #

Eq a => Eq (ApplyTo a) Source # 
Instance details

Defined in Data.Applicable

Methods

(==) :: ApplyTo a -> ApplyTo a -> Bool #

(/=) :: ApplyTo a -> ApplyTo a -> Bool #

Ord a => Ord (ApplyTo a) Source # 
Instance details

Defined in Data.Applicable

Methods

compare :: ApplyTo a -> ApplyTo a -> Ordering #

(<) :: ApplyTo a -> ApplyTo a -> Bool #

(<=) :: ApplyTo a -> ApplyTo a -> Bool #

(>) :: ApplyTo a -> ApplyTo a -> Bool #

(>=) :: ApplyTo a -> ApplyTo a -> Bool #

max :: ApplyTo a -> ApplyTo a -> ApplyTo a #

min :: ApplyTo a -> ApplyTo a -> ApplyTo a #

Applicable (ApplyTo a) (a -> b) b Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ApplyTo a -> (a -> b) -> b Source #

newtype ApplyMap a b Source #

A wrapper for functions. Can be applied to a Functor, fmap-ing the function over the inner values.

Constructors

AppMap 

Fields

Instances

Instances details
Functor (ApplyMap a) Source # 
Instance details

Defined in Data.Applicable

Methods

fmap :: (a0 -> b) -> ApplyMap a a0 -> ApplyMap a b #

(<$) :: a0 -> ApplyMap a b -> ApplyMap a a0 #

Functor f => Applicable (ApplyMap a b) (f a) (f b) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ApplyMap a b -> f a -> f b Source #

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.

Constructors

AppAp 

Fields

Instances

Instances details
Functor f => Functor (ApplyAp f a) Source # 
Instance details

Defined in Data.Applicable

Methods

fmap :: (a0 -> b) -> ApplyAp f a a0 -> ApplyAp f a b #

(<$) :: a0 -> ApplyAp f a b -> ApplyAp f a a0 #

Applicative f => Applicable (ApplyAp f a b) (f a) (f b) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ApplyAp f a b -> f a -> f b Source #

newtype ApplyBind m a b Source #

A wrapper for Kleisli arrows. Can be applied to a Monad, (>>=)-ing it on it.

Constructors

AppBind 

Fields

Instances

Instances details
Functor m => Functor (ApplyBind m a) Source # 
Instance details

Defined in Data.Applicable

Methods

fmap :: (a0 -> b) -> ApplyBind m a a0 -> ApplyBind m a b #

(<$) :: a0 -> ApplyBind m a b -> ApplyBind m a a0 #

Monad m => Applicable (ApplyBind m a b) (m a) (m b) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ApplyBind m a b -> m a -> m b Source #

newtype GroupAction a Source #

A wrapper for Semigroup members, representing the associated group action. Can be applied to another member, (<>)-ing them.

Constructors

GrpAct 

Fields

Instances

Instances details
Functor GroupAction Source # 
Instance details

Defined in Data.Applicable

Methods

fmap :: (a -> b) -> GroupAction a -> GroupAction b #

(<$) :: a -> GroupAction b -> GroupAction a #

Read a => Read (GroupAction a) Source # 
Instance details

Defined in Data.Applicable

Show a => Show (GroupAction a) Source # 
Instance details

Defined in Data.Applicable

Eq a => Eq (GroupAction a) Source # 
Instance details

Defined in Data.Applicable

Ord a => Ord (GroupAction a) Source # 
Instance details

Defined in Data.Applicable

Semigroup a => Applicable (GroupAction a) a a Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: GroupAction a -> a -> a Source #

newtype ChurchBool Source #

A wrapper for Bools. 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.

Constructors

ChBool 

Fields

Instances

Instances details
Bounded ChurchBool Source # 
Instance details

Defined in Data.Applicable

Enum ChurchBool Source # 
Instance details

Defined in Data.Applicable

Read ChurchBool Source # 
Instance details

Defined in Data.Applicable

Show ChurchBool Source # 
Instance details

Defined in Data.Applicable

Eq ChurchBool Source # 
Instance details

Defined in Data.Applicable

Ord ChurchBool Source # 
Instance details

Defined in Data.Applicable

Applicable ChurchBool a (a -> a) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ChurchBool -> a -> a -> a Source #

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.

Constructors

ChNum 

Fields

Instances

Instances details
Functor ChurchNumeral Source # 
Instance details

Defined in Data.Applicable

Methods

fmap :: (a -> b) -> ChurchNumeral a -> ChurchNumeral b #

(<$) :: a -> ChurchNumeral b -> ChurchNumeral a #

Read a => Read (ChurchNumeral a) Source # 
Instance details

Defined in Data.Applicable

Show a => Show (ChurchNumeral a) Source # 
Instance details

Defined in Data.Applicable

Eq a => Eq (ChurchNumeral a) Source # 
Instance details

Defined in Data.Applicable

Ord a => Ord (ChurchNumeral a) Source # 
Instance details

Defined in Data.Applicable

Integral a => Applicable (ChurchNumeral a) (a -> a) (a -> a) Source # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ChurchNumeral a -> (a -> a) -> a -> a Source #

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.

Constructors

ChTup 

Fields

Instances

Instances details
Bifunctor ChurchTuple Source # 
Instance details

Defined in Data.Applicable

Methods

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 #

Functor (ChurchTuple a) Source # 
Instance details

Defined in Data.Applicable

Methods

fmap :: (a0 -> b) -> ChurchTuple a a0 -> ChurchTuple a b #

(<$) :: a0 -> ChurchTuple a b -> ChurchTuple a a0 #

(Read a, Read b) => Read (ChurchTuple a b) Source # 
Instance details

Defined in Data.Applicable

(Show a, Show b) => Show (ChurchTuple a b) Source # 
Instance details

Defined in Data.Applicable

Methods

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 # 
Instance details

Defined in Data.Applicable

Methods

(==) :: ChurchTuple a b -> ChurchTuple a b -> Bool #

(/=) :: ChurchTuple a b -> ChurchTuple a b -> Bool #

(Ord a, Ord b) => Ord (ChurchTuple a b) Source # 
Instance details

Defined in Data.Applicable

Methods

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 # 
Instance details

Defined in Data.Applicable

Methods

($*) :: ChurchTuple a b -> (a -> b -> c) -> c Source #