Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Logical representations for some base
types along with their (orphan)
Logical
instances.
Synopsis
- _False :: Prism' Bool ()
- _True :: Prism' Bool ()
- _False' :: ExhaustivePrism Bool (false, true) (false', true) () false false'
- _True' :: ExhaustivePrism Bool (false, true) (false, true') () true true'
- data LogicList a
- _LogicNil :: forall a. Prism' (LogicList a) ()
- _LogicCons :: forall a a. Prism (LogicList a) (LogicList a) (Term a, Term [a]) (Term a, Term [a])
- _LogicNil' :: ExhaustivePrism (LogicList a) (logicNil, logicCons) (logicNil', logicCons) () logicNil logicNil'
- _LogicCons' :: ExhaustivePrism (LogicList a) (logicNil, logicCons) (logicNil, logicCons') (Term a, Term [a]) logicCons logicCons'
- data LogicMaybe (a :: Type)
- = LogicNothing
- | LogicJust (Term a)
- _LogicNothing :: forall a. Prism' (LogicMaybe a) ()
- _LogicJust :: forall a a. Prism (LogicMaybe a) (LogicMaybe a) (Term a) (Term a)
- _LogicNothing' :: ExhaustivePrism (LogicMaybe a) (logicNothing, logicJust) (logicNothing', logicJust) () logicNothing logicNothing'
- _LogicJust' :: ExhaustivePrism (LogicMaybe a) (logicNothing, logicJust) (logicNothing, logicJust') (Term a) logicJust logicJust'
- data LogicEither (a :: Type) (b :: Type)
- = LogicLeft (Term a)
- | LogicRight (Term b)
- _LogicLeft :: forall a b a. Prism (LogicEither a b) (LogicEither a b) (Term a) (Term a)
- _LogicRight :: forall a b b. Prism (LogicEither a b) (LogicEither a b) (Term b) (Term b)
- _LogicLeft' :: ExhaustivePrism (LogicEither a b) (logicLeft, logicRight) (logicLeft', logicRight) (Term a) logicLeft logicLeft'
- _LogicRight' :: ExhaustivePrism (LogicEither a b) (logicLeft, logicRight) (logicLeft, logicRight') (Term b) logicRight logicRight'
Primitive types
There are Logical
instances for Bool
, Char
, Int
, and Void
. They
don't require a separate logic representation.
Prisms for Bool
_False' :: ExhaustivePrism Bool (false, true) (false', true) () false false' Source #
_True' :: ExhaustivePrism Bool (false, true) (false, true') () true true' Source #
Tuples
For tuples, the logical representation is a tuple too, so they don't need a
separate logic type. Currently, there's a Logical
instance for 2-tuples
only.
Lists
Instances
Generic (LogicList a) Source # | |
IsList (LogicList a) Source # | |
Show (Logic a) => Show (LogicList a) Source # | This instance tries to print the list as a regular one. In case the tail is
unknown, the list is printed as |
NFData (Logic a) => NFData (LogicList a) Source # | |
Defined in Kanren.LogicalBase | |
Eq (Logic a) => Eq (LogicList a) Source # | |
type Rep (LogicList a) Source # | |
Defined in Kanren.LogicalBase type Rep (LogicList a) = D1 ('MetaData "LogicList" "Kanren.LogicalBase" "typedKanren-0.1.0.0-DCPxkt07imEEe1U3d5R120" 'False) (C1 ('MetaCons "LogicNil" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LogicCons" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term [a])))) | |
type Item (LogicList a) Source # | |
Defined in Kanren.LogicalBase |
Prisms for lists
_LogicCons :: forall a a. Prism (LogicList a) (LogicList a) (Term a, Term [a]) (Term a, Term [a]) Source #
_LogicNil' :: ExhaustivePrism (LogicList a) (logicNil, logicCons) (logicNil', logicCons) () logicNil logicNil' Source #
_LogicCons' :: ExhaustivePrism (LogicList a) (logicNil, logicCons) (logicNil, logicCons') (Term a, Term [a]) logicCons logicCons' Source #
Maybe
data LogicMaybe (a :: Type) Source #
Instances
Generic (LogicMaybe a) Source # | |
Defined in Kanren.LogicalBase type Rep (LogicMaybe a) :: Type -> Type # from :: LogicMaybe a -> Rep (LogicMaybe a) x # to :: Rep (LogicMaybe a) x -> LogicMaybe a # | |
Show (Logic a) => Show (LogicMaybe a) Source # | |
Defined in Kanren.LogicalBase showsPrec :: Int -> LogicMaybe a -> ShowS # show :: LogicMaybe a -> String # showList :: [LogicMaybe a] -> ShowS # | |
Eq (Logic a) => Eq (LogicMaybe a) Source # | |
Defined in Kanren.LogicalBase (==) :: LogicMaybe a -> LogicMaybe a -> Bool # (/=) :: LogicMaybe a -> LogicMaybe a -> Bool # | |
type Rep (LogicMaybe a) Source # | |
Defined in Kanren.LogicalBase type Rep (LogicMaybe a) = D1 ('MetaData "LogicMaybe" "Kanren.LogicalBase" "typedKanren-0.1.0.0-DCPxkt07imEEe1U3d5R120" 'False) (C1 ('MetaCons "LogicNothing" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LogicJust" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term a)))) |
Prisms for Maybe
_LogicNothing :: forall a. Prism' (LogicMaybe a) () Source #
_LogicJust :: forall a a. Prism (LogicMaybe a) (LogicMaybe a) (Term a) (Term a) Source #
_LogicNothing' :: ExhaustivePrism (LogicMaybe a) (logicNothing, logicJust) (logicNothing', logicJust) () logicNothing logicNothing' Source #
_LogicJust' :: ExhaustivePrism (LogicMaybe a) (logicNothing, logicJust) (logicNothing, logicJust') (Term a) logicJust logicJust' Source #
Either
data LogicEither (a :: Type) (b :: Type) Source #
LogicLeft (Term a) | |
LogicRight (Term b) |
Instances
Prisms for Either
_LogicLeft :: forall a b a. Prism (LogicEither a b) (LogicEither a b) (Term a) (Term a) Source #
_LogicRight :: forall a b b. Prism (LogicEither a b) (LogicEither a b) (Term b) (Term b) Source #
_LogicLeft' :: ExhaustivePrism (LogicEither a b) (logicLeft, logicRight) (logicLeft', logicRight) (Term a) logicLeft logicLeft' Source #
_LogicRight' :: ExhaustivePrism (LogicEither a b) (logicLeft, logicRight) (logicLeft, logicRight') (Term b) logicRight logicRight' Source #
Orphan instances
Logical Void Source # | |
Logical Bool Source # | |
Logical Char Source # | |
Logical Int Source # | |
Logical a => Logical (Maybe a) Source # | |
Logical a => Logical [a] Source # | |
(Logical a, Logical b) => Logical (Either a b) Source # | |
unify :: Logic (Either a b) -> Logic (Either a b) -> State -> Maybe State Source # walk :: State -> Logic (Either a b) -> Logic (Either a b) Source # occursCheck :: VarId b0 -> Logic (Either a b) -> State -> Bool Source # inject :: Either a b -> Logic (Either a b) Source # extract :: Logic (Either a b) -> Maybe (Either a b) Source # | |
(Logical a, Logical b) => Logical (a, b) Source # | |