| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Symantic.Classes
Contents
- Type
ReprKind - Class
Abstractable - Class
Anythingable - Class
Bottomable - Class
Constantable - Class
Eitherable - Class
Equalable - Class
IfThenElseable - Class
Inferable - Class
Listable - Class
Maybeable - Class
IsoFunctor - Class
ProductFunctor - Class
SumFunctor - Class
AlternativeFunctor - Class
Dicurryable - Class
Monoidable - Class
Repeatable - Class
Permutable - Class
Routable - Class
Voidable - Class
Substractable
Description
Comibnators in this module conflict with usual ones from the Prelude
hence they are meant to be imported either explicitely or qualified.
Synopsis
- type ReprKind = Type -> Type
- class Abstractable repr where
- class Functionable repr where
- class Anythingable repr where
- anything :: repr a -> repr a
- class Bottomable repr where
- bottom :: repr a
- class Constantable c repr where
- constant :: c -> repr c
- class Eitherable repr where
- class Equalable repr where
- (==) :: Abstractable repr => Equalable repr => Eq a => repr a -> repr a -> repr Bool
- class IfThenElseable repr where
- ifThenElse :: repr Bool -> repr a -> repr a -> repr a
- class Inferable a repr where
- infer :: repr a
- unit :: Inferable () repr => repr ()
- bool :: Inferable Bool repr => repr Bool
- char :: Inferable Char repr => repr Char
- int :: Inferable Int repr => repr Int
- natural :: Inferable Natural repr => repr Natural
- string :: Inferable String repr => repr String
- class Listable repr where
- class Maybeable repr where
- class IsoFunctor repr where
- data Iso a b = Iso {}
- class ProductFunctor repr where
- class SumFunctor repr where
- class AlternativeFunctor repr where
- (<|>) :: repr a -> repr a -> repr a
- class Dicurryable repr where
- construct :: forall args a repr. Dicurryable repr => Generic a => EoTOfRep a => CurryN args => Tuples args ~ EoT (ADT a) => args ~ Args (args -..-> a) => (args -..-> a) -> repr (Tuples args) -> repr a
- adt :: forall adt repr. IsoFunctor repr => Generic adt => RepOfEoT adt => EoTOfRep adt => repr (EoT (ADT adt)) -> repr adt
- class (Emptyable repr, Semigroupable repr) => Monoidable repr
- class Emptyable repr where
- empty :: repr a
- class Semigroupable repr where
- (<>) :: Abstractable repr => Semigroupable repr => Semigroup a => repr a -> repr a -> repr a
- class Optionable repr where
- class Repeatable repr where
- many :: Repeatable repr => repr a -> repr [a]
- some :: Repeatable repr => repr a -> repr [a]
- class Permutable repr where
- type Permutation (repr :: ReprKind) = (r :: ReprKind) | r -> repr
- permutable :: Permutation repr a -> repr a
- perm :: repr a -> Permutation repr a
- noPerm :: Permutation repr ()
- permWithDefault :: a -> repr a -> Permutation repr a
- optionalPerm :: Eitherable repr => IsoFunctor repr => Permutable repr => repr a -> Permutation repr (Maybe a)
- (<&>) :: Permutable repr => ProductFunctor (Permutation repr) => repr a -> Permutation repr b -> Permutation repr (a, b)
- (<?&>) :: Eitherable repr => IsoFunctor repr => Permutable repr => ProductFunctor (Permutation repr) => repr a -> Permutation repr b -> Permutation repr (Maybe a, b)
- (<*&>) :: Eitherable repr => Repeatable repr => IsoFunctor repr => Permutable repr => ProductFunctor (Permutation repr) => repr a -> Permutation repr b -> Permutation repr ([a], b)
- (<+&>) :: Eitherable repr => Repeatable repr => IsoFunctor repr => Permutable repr => ProductFunctor (Permutation repr) => repr a -> Permutation repr b -> Permutation repr ([a], b)
- class Routable repr where
- (<!>) :: repr a -> repr b -> repr (a, b)
- pattern (:!:) :: a -> b -> (a, b)
- class Voidable repr where
- void :: a -> repr a -> repr ()
- class Substractable repr where
- (<->) :: repr a -> repr b -> repr a
Type ReprKind
Class Abstractable
class Abstractable repr where Source #
Minimal complete definition
Nothing
Methods
lam :: (repr a -> repr b) -> repr (a -> b) Source #
Lambda term abstraction, in HOAS (Higher-Order Abstract Syntax) style.
default lam :: FromDerived Abstractable repr => Derivable repr => (repr a -> repr b) -> repr (a -> b) Source #
lam1 :: (repr a -> repr b) -> repr (a -> b) Source #
Like lam but whose argument must be used only once,
hence safe to beta-reduce (inline) without duplicating work.
default lam1 :: FromDerived Abstractable repr => Derivable repr => (repr a -> repr b) -> repr (a -> b) Source #
var :: repr a -> repr a Source #
default var :: FromDerived1 Abstractable repr => repr a -> repr a Source #
(.@) :: repr (a -> b) -> repr a -> repr b infixl 9 Source #
Application, aka. unabstract.
default (.@) :: FromDerived2 Abstractable repr => repr (a -> b) -> repr a -> repr b Source #
Instances
| Abstractable Viewer Source # | |
| Abstractable repr => Abstractable (SomeData repr) Source # | |
Defined in Symantic.Data | |
| Abstractable repr => Derivable (Data Abstractable repr) Source # | |
Defined in Symantic.Data Methods derive :: Data Abstractable repr a -> Derived (Data Abstractable repr) a Source # | |
| data Data Abstractable repr a Source # | |
Defined in Symantic.Data data Data Abstractable repr a where
| |
Class Functionable
class Functionable repr where Source #
Minimal complete definition
Nothing
Methods
const :: repr (a -> b -> a) Source #
default const :: FromDerived Functionable repr => repr (a -> b -> a) Source #
flip :: repr ((a -> b -> c) -> b -> a -> c) Source #
default flip :: FromDerived Functionable repr => repr ((a -> b -> c) -> b -> a -> c) Source #
default id :: FromDerived Functionable repr => repr (a -> a) Source #
(.) :: repr ((b -> c) -> (a -> b) -> a -> c) infixr 9 Source #
default (.) :: FromDerived Functionable repr => repr ((b -> c) -> (a -> b) -> a -> c) Source #
($) :: repr ((a -> b) -> a -> b) infixr 0 Source #
default ($) :: FromDerived Functionable repr => repr ((a -> b) -> a -> b) Source #
Instances
| Abstractable repr => Functionable (SomeData repr) Source # | |
Class Anythingable
class Anythingable repr where Source #
Minimal complete definition
Nothing
Instances
| Anythingable Viewer Source # | |
| Anythingable (SomeData repr) Source # | |
| Anythingable repr => Derivable (Data Anythingable repr) Source # | |
Defined in Symantic.Data Methods derive :: Data Anythingable repr a -> Derived (Data Anythingable repr) a Source # | |
| Anythingable (Data Anythingable repr) Source # | |
Defined in Symantic.Data Methods anything :: Data Anythingable repr a -> Data Anythingable repr a Source # | |
| data Data Anythingable repr a Source # | |
Defined in Symantic.Data data Data Anythingable repr a where
| |
Class Bottomable
class Bottomable repr where Source #
Instances
| Bottomable Viewer Source # | |
Defined in Symantic.Viewer | |
| Bottomable repr => Derivable (Data Bottomable repr) Source # | |
Defined in Symantic.Data Methods derive :: Data Bottomable repr a -> Derived (Data Bottomable repr) a Source # | |
| data Data Bottomable repr a Source # | |
Defined in Symantic.Data | |
Class Constantable
class Constantable c repr where Source #
Minimal complete definition
Nothing
Methods
constant :: c -> repr c Source #
default constant :: FromDerived (Constantable c) repr => c -> repr c Source #
Instances
| Show c => Constantable c Viewer Source # | |
Defined in Symantic.Viewer | |
| (Constantable c repr, Typeable c) => Constantable c (SomeData repr) Source # | |
Defined in Symantic.Data | |
| Constantable c (Data (Constantable c) repr) Source # | |
Defined in Symantic.Data Methods constant :: c -> Data (Constantable c) repr c Source # | |
| Constantable c repr => Derivable (Data (Constantable c) repr) Source # | |
Defined in Symantic.Data Methods derive :: Data (Constantable c) repr a -> Derived (Data (Constantable c) repr) a Source # | |
| data Data (Constantable c) repr a Source # | |
Defined in Symantic.Data data Data (Constantable c) repr a where
| |
Class Eitherable
class Eitherable repr where Source #
Minimal complete definition
Nothing
Methods
left :: repr (l -> Either l r) Source #
default left :: FromDerived Eitherable repr => repr (l -> Either l r) Source #
right :: repr (r -> Either l r) Source #
default right :: FromDerived Eitherable repr => repr (r -> Either l r) Source #
Instances
| Eitherable Viewer Source # | |
| Eitherable repr => Eitherable (SomeData repr) Source # | |
| Eitherable repr => Derivable (Data Eitherable repr) Source # | |
Defined in Symantic.Data Methods derive :: Data Eitherable repr a -> Derived (Data Eitherable repr) a Source # | |
| Eitherable (Data Eitherable repr) Source # | |
Defined in Symantic.Data | |
| data Data Eitherable repr a Source # | |
Defined in Symantic.Data data Data Eitherable repr a where
| |
Class Equalable
class Equalable repr where Source #
Minimal complete definition
Nothing
Methods
(==) :: Abstractable repr => Equalable repr => Eq a => repr a -> repr a -> repr Bool infix 4 Source #
Class IfThenElseable
class IfThenElseable repr where Source #
Minimal complete definition
Nothing
Methods
ifThenElse :: repr Bool -> repr a -> repr a -> repr a Source #
default ifThenElse :: FromDerived3 IfThenElseable repr => repr Bool -> repr a -> repr a -> repr a Source #
Instances
| IfThenElseable repr => IfThenElseable (SomeData repr) Source # | |
Defined in Symantic.Data | |
| IfThenElseable repr => Derivable (Data IfThenElseable repr) Source # | |
Defined in Symantic.Data Methods derive :: Data IfThenElseable repr a -> Derived (Data IfThenElseable repr) a Source # | |
| IfThenElseable repr => IfThenElseable (Data IfThenElseable repr) Source # | |
Defined in Symantic.Data Methods ifThenElse :: Data IfThenElseable repr Bool -> Data IfThenElseable repr a -> Data IfThenElseable repr a -> Data IfThenElseable repr a Source # | |
| data Data IfThenElseable repr a Source # | |
Defined in Symantic.Data data Data IfThenElseable repr a where
| |
Class Inferable
Class Listable
class Listable repr where Source #
Minimal complete definition
Nothing
Methods
cons :: repr (a -> [a] -> [a]) Source #
default cons :: FromDerived Listable repr => repr (a -> [a] -> [a]) Source #
default nil :: FromDerived Listable repr => repr [a] Source #
Class Maybeable
class Maybeable repr where Source #
Minimal complete definition
Nothing
Class IsoFunctor
class IsoFunctor repr where Source #
Minimal complete definition
Nothing
Methods
(<%>) :: Iso a b -> repr a -> repr b infixl 4 Source #
default (<%>) :: FromDerived1 IsoFunctor repr => Iso a b -> repr a -> repr b Source #
Type Iso
Class ProductFunctor
class ProductFunctor repr where Source #
Minimal complete definition
Nothing
Methods
(<.>) :: repr a -> repr b -> repr (a, b) infixr 4 Source #
default (<.>) :: FromDerived2 ProductFunctor repr => repr a -> repr b -> repr (a, b) Source #
(<.) :: repr a -> repr () -> repr a infixr 4 Source #
default (<.) :: IsoFunctor repr => repr a -> repr () -> repr a Source #
(.>) :: repr () -> repr a -> repr a infixr 4 Source #
default (.>) :: IsoFunctor repr => repr () -> repr a -> repr a Source #
Class SumFunctor
class SumFunctor repr where Source #
Minimal complete definition
Nothing
Methods
(<+>) :: repr a -> repr b -> repr (Either a b) infixr 3 Source #
default (<+>) :: FromDerived2 SumFunctor repr => repr a -> repr b -> repr (Either a b) Source #
Class AlternativeFunctor
class AlternativeFunctor repr where Source #
Minimal complete definition
Nothing
Methods
(<|>) :: repr a -> repr a -> repr a infixr 3 Source #
default (<|>) :: FromDerived2 AlternativeFunctor repr => repr a -> repr a -> repr a Source #
Class Dicurryable
class Dicurryable repr where Source #
Minimal complete definition
Nothing
construct :: forall args a repr. Dicurryable repr => Generic a => EoTOfRep a => CurryN args => Tuples args ~ EoT (ADT a) => args ~ Args (args -..-> a) => (args -..-> a) -> repr (Tuples args) -> repr a Source #
adt :: forall adt repr. IsoFunctor repr => Generic adt => RepOfEoT adt => EoTOfRep adt => repr (EoT (ADT adt)) -> repr adt Source #
Class Monoidable
class (Emptyable repr, Semigroupable repr) => Monoidable repr Source #
Instances
| (Emptyable repr, Semigroupable repr) => Monoidable repr Source # | |
Defined in Symantic.Classes | |
Class Emptyable
class Emptyable repr where Source #
Minimal complete definition
Nothing
Class Semigroupable
class Semigroupable repr where Source #
Minimal complete definition
Nothing
Methods
concat :: Semigroup a => repr (a -> a -> a) infixr 6 Source #
default concat :: FromDerived Semigroupable repr => Semigroup a => repr (a -> a -> a) Source #
Instances
| Semigroupable repr => Semigroupable (SomeData repr) Source # | |
| Semigroupable repr => Derivable (Data Semigroupable repr) Source # | |
Defined in Symantic.Data Methods derive :: Data Semigroupable repr a -> Derived (Data Semigroupable repr) a Source # | |
| Semigroupable (Data Semigroupable repr) Source # | |
Defined in Symantic.Data | |
| data Data Semigroupable repr a Source # | |
Defined in Symantic.Data data Data Semigroupable repr a where
| |
(<>) :: Abstractable repr => Semigroupable repr => Semigroup a => repr a -> repr a -> repr a infixr 6 Source #
Class Optionable
class Optionable repr where Source #
Minimal complete definition
Nothing
Methods
option :: repr a -> repr a Source #
default option :: FromDerived1 Optionable repr => repr a -> repr a Source #
optional :: repr a -> repr (Maybe a) Source #
default optional :: FromDerived1 Optionable repr => repr a -> repr (Maybe a) Source #
Class Repeatable
class Repeatable repr where Source #
Minimal complete definition
Nothing
Methods
many0 :: repr a -> repr [a] Source #
default many0 :: FromDerived1 Repeatable repr => repr a -> repr [a] Source #
many1 :: repr a -> repr [a] Source #
default many1 :: FromDerived1 Repeatable repr => repr a -> repr [a] Source #
many :: Repeatable repr => repr a -> repr [a] Source #
Alias to many0.
some :: Repeatable repr => repr a -> repr [a] Source #
Alias to many1.
Class Permutable
class Permutable repr where Source #
Minimal complete definition
Associated Types
type Permutation (repr :: ReprKind) = (r :: ReprKind) | r -> repr Source #
type Permutation repr = Permutation (Derived repr)
Methods
permutable :: Permutation repr a -> repr a Source #
perm :: repr a -> Permutation repr a Source #
noPerm :: Permutation repr () Source #
permWithDefault :: a -> repr a -> Permutation repr a Source #
optionalPerm :: Eitherable repr => IsoFunctor repr => Permutable repr => repr a -> Permutation repr (Maybe a) Source #
(<&>) :: Permutable repr => ProductFunctor (Permutation repr) => repr a -> Permutation repr b -> Permutation repr (a, b) infixr 4 Source #
(<?&>) :: Eitherable repr => IsoFunctor repr => Permutable repr => ProductFunctor (Permutation repr) => repr a -> Permutation repr b -> Permutation repr (Maybe a, b) infixr 4 Source #
(<*&>) :: Eitherable repr => Repeatable repr => IsoFunctor repr => Permutable repr => ProductFunctor (Permutation repr) => repr a -> Permutation repr b -> Permutation repr ([a], b) infixr 4 Source #
(<+&>) :: Eitherable repr => Repeatable repr => IsoFunctor repr => Permutable repr => ProductFunctor (Permutation repr) => repr a -> Permutation repr b -> Permutation repr ([a], b) infixr 4 Source #
Class Routable
pattern (:!:) :: a -> b -> (a, b) infixr 4 Source #
Like (,) but infixr.
Mostly useful for clarity when using Routable.
Class Voidable
Class Substractable
class Substractable repr where Source #
Minimal complete definition
Nothing
Methods
(<->) :: repr a -> repr b -> repr a infixr 3 Source #
default (<->) :: FromDerived2 Substractable repr => repr a -> repr b -> repr a Source #