Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
- Type
Syntax
- 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
Dataable
- Class
IfSemantic
- Class
Monoidable
- Class
Repeatable
- Class
Permutable
- Class
Voidable
- Class
Substractable
Combinators in this module conflict with usual ones from the Prelude
hence they are meant to be imported either explicitely or qualified.
Synopsis
- type Syntax = Semantic -> Constraint
- type family Syntaxes (syns :: [Syntax]) (sem :: Semantic) :: Constraint where ...
- class Unabstractable sem => Abstractable sem where
- class Unabstractable sem where
- (.@) :: sem (a -> b) -> sem a -> sem b
- class Functionable sem where
- class Anythingable sem where
- anything :: sem a -> sem a
- class Bottomable sem where
- bottom :: sem a
- class Constantable c sem where
- constant :: c -> sem c
- class Eitherable sem where
- class Equalable sem where
- (==) :: Abstractable sem => Equalable sem => Eq a => sem a -> sem a -> sem Bool
- class IfThenElseable sem where
- ifThenElse :: sem Bool -> sem a -> sem a -> sem a
- class Inferable a sem where
- infer :: sem a
- unit :: Inferable () sem => sem ()
- bool :: Inferable Bool sem => sem Bool
- char :: Inferable Char sem => sem Char
- int :: Inferable Int sem => sem Int
- natural :: Inferable Natural sem => sem Natural
- string :: Inferable String sem => sem String
- class Listable sem where
- class Maybeable sem where
- class IsoFunctor sem where
- data Iso a b = Iso {}
- class ProductFunctor sem where
- class SumFunctor sem where
- pattern (:!:) :: a -> b -> (a, b)
- class AlternativeFunctor sem where
- (<|>) :: sem a -> sem a -> sem a
- class Dicurryable sem where
- construct :: forall args a sem. Dicurryable sem => Generic a => EoTOfRep a => CurryN args => Tuples args ~ EoT (ADT a) => args ~ Args (args -..-> a) => (args -..-> a) -> sem (Tuples args) -> sem a
- class Dataable sem where
- dataType :: forall a sem. Dataable sem => Generic a => RepOfEoT a => UnToF a => sem (EoT (ADT a)) -> sem a
- class IfSemantic (thenSyntaxes :: [Syntax]) (elseSyntaxes :: [Syntax]) thenSemantic elseSemantic where
- ifSemantic :: (Syntaxes thenSyntaxes thenSemantic => thenSemantic a) -> (Syntaxes elseSyntaxes elseSemantic => elseSemantic a) -> elseSemantic a
- class (Emptyable sem, Semigroupable sem) => Monoidable sem
- class Emptyable sem where
- empty :: sem a
- class Semigroupable sem where
- (<>) :: Abstractable sem => Semigroupable sem => Semigroup a => sem a -> sem a -> sem a
- class Optionable sem where
- class Repeatable sem where
- many :: Repeatable sem => sem a -> sem [a]
- some :: Repeatable sem => sem a -> sem [a]
- class Permutable sem where
- type Permutation (sem :: Semantic) = (r :: Semantic) | r -> sem
- permutable :: Permutation sem a -> sem a
- perm :: sem a -> Permutation sem a
- noPerm :: Permutation sem ()
- permWithDefault :: a -> sem a -> Permutation sem a
- optionalPerm :: Eitherable sem => IsoFunctor sem => Permutable sem => sem a -> Permutation sem (Maybe a)
- (<&>) :: Permutable sem => ProductFunctor (Permutation sem) => sem a -> Permutation sem b -> Permutation sem (a, b)
- (<?&>) :: Eitherable sem => IsoFunctor sem => Permutable sem => ProductFunctor (Permutation sem) => sem a -> Permutation sem b -> Permutation sem (Maybe a, b)
- (<*&>) :: Eitherable sem => Repeatable sem => IsoFunctor sem => Permutable sem => ProductFunctor (Permutation sem) => sem a -> Permutation sem b -> Permutation sem ([a], b)
- (<+&>) :: Eitherable sem => Repeatable sem => IsoFunctor sem => Permutable sem => ProductFunctor (Permutation sem) => sem a -> Permutation sem b -> Permutation sem ([a], b)
- class Voidable sem where
- void :: a -> sem a -> sem ()
- class Substractable sem where
- (<->) :: sem a -> sem b -> sem a
Type Syntax
type Syntax = Semantic -> Constraint Source #
Type family Syntaxes
type family Syntaxes (syns :: [Syntax]) (sem :: Semantic) :: Constraint where ... Source #
Merge several Syntax
es into a single one.
Useful in IfSemantic
.
Class Abstractable
class Unabstractable sem => Abstractable sem where Source #
Nothing
lam :: (sem a -> sem b) -> sem (a -> b) Source #
Lambda term abstraction, in HOAS (Higher-Order Abstract Syntax) style.
default lam :: FromDerived Abstractable sem => Derivable sem => (sem a -> sem b) -> sem (a -> b) Source #
lam1 :: (sem a -> sem b) -> sem (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 sem => Derivable sem => (sem a -> sem b) -> sem (a -> b) Source #
var :: sem a -> sem a Source #
default var :: FromDerived1 Abstractable sem => sem a -> sem a Source #
Instances
Abstractable Viewer Source # | |
Abstractable sem => Abstractable (SomeData sem) Source # | |
Abstractable sem => Abstractable (Reader r sem) Source # | |
Abstractable sem => Derivable (Data Abstractable sem) Source # | |
Defined in Symantic.Syntaxes.Data derive :: Data Abstractable sem a -> Derived (Data Abstractable sem) a Source # | |
data Data Abstractable sem a Source # | |
Defined in Symantic.Syntaxes.Data |
Class Unabstractable
class Unabstractable sem where Source #
Nothing
(.@) :: sem (a -> b) -> sem a -> sem b infixl 9 Source #
Application, aka. unabstract.
default (.@) :: FromDerived2 Unabstractable sem => sem (a -> b) -> sem a -> sem b Source #
Instances
Unabstractable Viewer Source # | |
Unabstractable sem => Unabstractable (SomeData sem) Source # | |
Unabstractable sem => Unabstractable (Reader r sem) Source # | |
Unabstractable sem => Derivable (Data Unabstractable sem) Source # | |
Defined in Symantic.Syntaxes.Data derive :: Data Unabstractable sem a -> Derived (Data Unabstractable sem) a Source # | |
data Data Unabstractable sem a Source # | |
Defined in Symantic.Syntaxes.Data |
Class Functionable
class Functionable sem where Source #
Nothing
const :: sem (a -> b -> a) Source #
default const :: FromDerived Functionable sem => sem (a -> b -> a) Source #
flip :: sem ((a -> b -> c) -> b -> a -> c) Source #
default flip :: FromDerived Functionable sem => sem ((a -> b -> c) -> b -> a -> c) Source #
default id :: FromDerived Functionable sem => sem (a -> a) Source #
(.) :: sem ((b -> c) -> (a -> b) -> a -> c) infixr 9 Source #
default (.) :: FromDerived Functionable sem => sem ((b -> c) -> (a -> b) -> a -> c) Source #
($) :: sem ((a -> b) -> a -> b) infixr 0 Source #
default ($) :: FromDerived Functionable sem => sem ((a -> b) -> a -> b) Source #
Instances
Abstractable sem => Functionable (SomeData sem) Source # | |
Functionable sem => Functionable (Reader r sem) Source # | |
Class Anythingable
class Anythingable sem where Source #
Nothing
Instances
Anythingable Viewer Source # | |
Anythingable (SomeData sem) Source # | |
Anythingable sem => Anythingable (Reader r sem) Source # | |
Anythingable (Data Anythingable sem) Source # | |
Defined in Symantic.Syntaxes.Data anything :: Data Anythingable sem a -> Data Anythingable sem a Source # | |
Anythingable sem => Derivable (Data Anythingable sem) Source # | |
Defined in Symantic.Syntaxes.Data derive :: Data Anythingable sem a -> Derived (Data Anythingable sem) a Source # | |
data Data Anythingable sem a Source # | |
Defined in Symantic.Syntaxes.Data data Data Anythingable sem a where
|
Class Bottomable
class Bottomable sem where Source #
Instances
Bottomable Viewer Source # | |
Defined in Symantic.Semantics.Viewer | |
Bottomable sem => Derivable (Data Bottomable sem) Source # | |
Defined in Symantic.Syntaxes.Data derive :: Data Bottomable sem a -> Derived (Data Bottomable sem) a Source # | |
data Data Bottomable sem a Source # | |
Defined in Symantic.Syntaxes.Data |
Class Constantable
class Constantable c sem where Source #
Nothing
constant :: c -> sem c Source #
default constant :: FromDerived (Constantable c) sem => c -> sem c Source #
Instances
Show c => Constantable c Viewer Source # | |
Defined in Symantic.Semantics.Viewer | |
(Constantable c sem, Typeable c) => Constantable c (SomeData sem) Source # | |
Defined in Symantic.Syntaxes.Data | |
Constantable c sem => Constantable c (Reader r sem) Source # | |
Defined in Symantic.Semantics.Reader | |
Constantable c (Data (Constantable c) sem) Source # | |
Defined in Symantic.Syntaxes.Data constant :: c -> Data (Constantable c) sem c Source # | |
Constantable c sem => Derivable (Data (Constantable c) sem) Source # | |
Defined in Symantic.Syntaxes.Data derive :: Data (Constantable c) sem a -> Derived (Data (Constantable c) sem) a Source # | |
data Data (Constantable c) sem a Source # | |
Defined in Symantic.Syntaxes.Data data Data (Constantable c) sem a where
|
Class Eitherable
class Eitherable sem where Source #
Nothing
either :: sem ((l -> a) -> (r -> a) -> Either l r -> a) Source #
default either :: FromDerived Eitherable sem => sem ((l -> a) -> (r -> a) -> Either l r -> a) Source #
left :: sem (l -> Either l r) Source #
default left :: FromDerived Eitherable sem => sem (l -> Either l r) Source #
right :: sem (r -> Either l r) Source #
default right :: FromDerived Eitherable sem => sem (r -> Either l r) Source #
Instances
Eitherable Viewer Source # | |
Eitherable sem => Eitherable (SomeData sem) Source # | |
Eitherable sem => Eitherable (Reader r sem) Source # | |
Eitherable (Data Eitherable sem) Source # | |
Defined in Symantic.Syntaxes.Data | |
Eitherable sem => Derivable (Data Eitherable sem) Source # | |
Defined in Symantic.Syntaxes.Data derive :: Data Eitherable sem a -> Derived (Data Eitherable sem) a Source # | |
data Data Eitherable sem a Source # | |
Defined in Symantic.Syntaxes.Data data Data Eitherable sem a where
|
Class Equalable
class Equalable sem where Source #
Nothing
Class IfThenElseable
class IfThenElseable sem where Source #
Nothing
ifThenElse :: sem Bool -> sem a -> sem a -> sem a Source #
default ifThenElse :: FromDerived3 IfThenElseable sem => sem Bool -> sem a -> sem a -> sem a Source #
Instances
IfThenElseable sem => IfThenElseable (SomeData sem) Source # | |
Defined in Symantic.Syntaxes.Data | |
IfThenElseable sem => IfThenElseable (Reader r sem) Source # | |
Defined in Symantic.Semantics.Reader | |
IfThenElseable sem => IfThenElseable (Data IfThenElseable sem) Source # | |
Defined in Symantic.Syntaxes.Data ifThenElse :: Data IfThenElseable sem Bool -> Data IfThenElseable sem a -> Data IfThenElseable sem a -> Data IfThenElseable sem a Source # | |
IfThenElseable sem => Derivable (Data IfThenElseable sem) Source # | |
Defined in Symantic.Syntaxes.Data derive :: Data IfThenElseable sem a -> Derived (Data IfThenElseable sem) a Source # | |
data Data IfThenElseable sem a Source # | |
Defined in Symantic.Syntaxes.Data data Data IfThenElseable sem a where
|
Class Inferable
Class Listable
class Listable sem where Source #
Nothing
cons :: sem (a -> [a] -> [a]) Source #
default cons :: FromDerived Listable sem => sem (a -> [a] -> [a]) Source #
default nil :: FromDerived Listable sem => sem [a] Source #
Class Maybeable
class Maybeable sem where Source #
Nothing
Class IsoFunctor
class IsoFunctor sem where Source #
Nothing
(<%>) :: Iso a b -> sem a -> sem b infixl 4 Source #
default (<%>) :: FromDerived1 IsoFunctor sem => Iso a b -> sem a -> sem b Source #
Instances
IsoFunctor sem => IsoFunctor (Reader r sem) Source # | |
Type Iso
Class ProductFunctor
class ProductFunctor sem where Source #
Nothing
(<.>) :: sem a -> sem b -> sem (a, b) infixr 4 Source #
default (<.>) :: FromDerived2 ProductFunctor sem => sem a -> sem b -> sem (a, b) Source #
(<.) :: sem a -> sem () -> sem a infixr 4 Source #
default (<.) :: IsoFunctor sem => sem a -> sem () -> sem a Source #
(.>) :: sem () -> sem a -> sem a infixr 4 Source #
default (.>) :: IsoFunctor sem => sem () -> sem a -> sem a Source #
Instances
(ProductFunctor sem, Monad sem) => ProductFunctor (ToFer sem) Source # | |
(ProductFunctor sem, IsoFunctor sem) => ProductFunctor (Reader r sem) Source # | |
Class SumFunctor
class SumFunctor sem where Source #
Nothing
(<+>) :: sem a -> sem b -> sem (Either a b) infixr 3 Source #
default (<+>) :: FromDerived2 SumFunctor sem => sem a -> sem b -> sem (Either a b) Source #
Instances
(SumFunctor sem, AlternativeFunctor sem) => SumFunctor (ToFer sem) Source # | |
(SumFunctor sem, IsoFunctor sem) => SumFunctor (Reader r sem) Source # | |
pattern (:!:) :: a -> b -> (a, b) infixr 4 Source #
Like (,)
but infixr
.
Mostly useful for clarity when using SumFunctor
.
Class AlternativeFunctor
class AlternativeFunctor sem where Source #
Nothing
(<|>) :: sem a -> sem a -> sem a infixr 3 Source #
default (<|>) :: FromDerived2 AlternativeFunctor sem => sem a -> sem a -> sem a Source #
Instances
AlternativeFunctor sem => AlternativeFunctor (Reader r sem) Source # | |
Class Dicurryable
class Dicurryable sem where Source #
Nothing
construct :: forall args a sem. Dicurryable sem => Generic a => EoTOfRep a => CurryN args => Tuples args ~ EoT (ADT a) => args ~ Args (args -..-> a) => (args -..-> a) -> sem (Tuples args) -> sem a Source #
Class Dataable
class Dataable sem where Source #
Enable the contruction or deconstruction of a any algebraic data type
Nothing
dataType :: forall a sem. Dataable sem => Generic a => RepOfEoT a => UnToF a => sem (EoT (ADT a)) -> sem a Source #
Like data_
but with the (a)
type parameter first
for convenience when specifying it.
Class IfSemantic
class IfSemantic (thenSyntaxes :: [Syntax]) (elseSyntaxes :: [Syntax]) thenSemantic elseSemantic where Source #
IfSemantic
enables to change the Syntax
for a specific Semantic
.
Useful when a Semantic
does not implement some Syntax
es used by other Semantic
s.
ifSemantic :: (Syntaxes thenSyntaxes thenSemantic => thenSemantic a) -> (Syntaxes elseSyntaxes elseSemantic => elseSemantic a) -> elseSemantic a Source #
Instances
Syntaxes elseSyntaxes elseSemantic => IfSemantic thenSyntaxes elseSyntaxes thenSemantic elseSemantic Source # | |
Defined in Symantic.Syntaxes.Classes ifSemantic :: (Syntaxes thenSyntaxes thenSemantic => thenSemantic a) -> (Syntaxes elseSyntaxes elseSemantic => elseSemantic a) -> elseSemantic a Source # | |
Syntaxes thenSyntaxes thenSemantic => IfSemantic thenSyntaxes elseSyntaxes thenSemantic thenSemantic Source # | |
Defined in Symantic.Syntaxes.Classes ifSemantic :: (Syntaxes thenSyntaxes thenSemantic => thenSemantic a) -> (Syntaxes elseSyntaxes thenSemantic => thenSemantic a) -> thenSemantic a Source # |
Class Monoidable
class (Emptyable sem, Semigroupable sem) => Monoidable sem Source #
Instances
(Emptyable sem, Semigroupable sem) => Monoidable sem Source # | |
Defined in Symantic.Syntaxes.Classes |
Class Emptyable
class Emptyable sem where Source #
Nothing
Instances
Emptyable sem => Emptyable (SomeData sem) Source # | |
Defined in Symantic.Syntaxes.Data | |
Emptyable sem => Emptyable (Reader r sem) Source # | |
Defined in Symantic.Semantics.Reader | |
Emptyable (Data Emptyable sem) Source # | |
Emptyable sem => Derivable (Data Emptyable sem) Source # | |
data Data Emptyable sem a Source # | |
Class Semigroupable
class Semigroupable sem where Source #
Nothing
concat :: Semigroup a => sem (a -> a -> a) infixr 6 Source #
default concat :: FromDerived Semigroupable sem => Semigroup a => sem (a -> a -> a) Source #
Instances
Semigroupable sem => Semigroupable (SomeData sem) Source # | |
Semigroupable sem => Semigroupable (Reader r sem) Source # | |
Semigroupable (Data Semigroupable sem) Source # | |
Defined in Symantic.Syntaxes.Data | |
Semigroupable sem => Derivable (Data Semigroupable sem) Source # | |
Defined in Symantic.Syntaxes.Data derive :: Data Semigroupable sem a -> Derived (Data Semigroupable sem) a Source # | |
data Data Semigroupable sem a Source # | |
Defined in Symantic.Syntaxes.Data data Data Semigroupable sem a where
|
(<>) :: Abstractable sem => Semigroupable sem => Semigroup a => sem a -> sem a -> sem a infixr 6 Source #
Class Optionable
class Optionable sem where Source #
Nothing
optional :: sem a -> sem (Maybe a) Source #
default optional :: FromDerived1 Optionable sem => sem a -> sem (Maybe a) Source #
Instances
(Optionable sem, Functor sem) => Optionable (ToFer sem) Source # | |
Optionable sem => Optionable (Reader r sem) Source # | |
Class Repeatable
class Repeatable sem where Source #
Nothing
many0 :: sem a -> sem [a] Source #
default many0 :: FromDerived1 Repeatable sem => sem a -> sem [a] Source #
many1 :: sem a -> sem [a] Source #
default many1 :: FromDerived1 Repeatable sem => sem a -> sem [a] Source #
many :: Repeatable sem => sem a -> sem [a] Source #
Alias to many0
.
some :: Repeatable sem => sem a -> sem [a] Source #
Alias to many1
.
Class Permutable
class Permutable sem where Source #
type Permutation (sem :: Semantic) = (r :: Semantic) | r -> sem Source #
type Permutation sem = Permutation (Derived sem)
permutable :: Permutation sem a -> sem a Source #
perm :: sem a -> Permutation sem a Source #
noPerm :: Permutation sem () Source #
permWithDefault :: a -> sem a -> Permutation sem a Source #
optionalPerm :: Eitherable sem => IsoFunctor sem => Permutable sem => sem a -> Permutation sem (Maybe a) Source #
(<&>) :: Permutable sem => ProductFunctor (Permutation sem) => sem a -> Permutation sem b -> Permutation sem (a, b) infixr 4 Source #
(<?&>) :: Eitherable sem => IsoFunctor sem => Permutable sem => ProductFunctor (Permutation sem) => sem a -> Permutation sem b -> Permutation sem (Maybe a, b) infixr 4 Source #
(<*&>) :: Eitherable sem => Repeatable sem => IsoFunctor sem => Permutable sem => ProductFunctor (Permutation sem) => sem a -> Permutation sem b -> Permutation sem ([a], b) infixr 4 Source #
(<+&>) :: Eitherable sem => Repeatable sem => IsoFunctor sem => Permutable sem => ProductFunctor (Permutation sem) => sem a -> Permutation sem b -> Permutation sem ([a], b) infixr 4 Source #
Class Voidable
class Voidable sem where Source #
Nothing
Class Substractable
class Substractable sem where Source #
Nothing
(<->) :: sem a -> sem b -> sem a infixr 3 Source #
default (<->) :: FromDerived2 Substractable sem => sem a -> sem b -> sem a Source #
Instances
Substractable sem => Substractable (Reader r sem) Source # | |