Copyright | (C) 2017-18 Jakub Daniel |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Jakub Daniel <jakub.daniel@protonmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Data.Expression.Sort
Description
Synopsis
- data Sort
- = BooleanSort
- | IntegralSort
- | ArraySort { }
- data family Sing (a :: k) :: Type
- withSort :: forall a (s :: Sort). Sing s -> (SingI s => a) -> a
- data DynamicSort where
- DynamicSort :: forall (s :: Sort). Sing s -> DynamicSort
- data DynamicallySorted (d :: Sort -> *) where
- DynamicallySorted :: forall (s :: Sort) d. Sing s -> d s -> DynamicallySorted d
- type DynamicallySortedFix f = DynamicallySorted (IFix f)
- parseSort :: Parser DynamicSort
- toDynamicallySorted :: forall d (s :: Sort). SingI s => d s -> DynamicallySorted d
- toStaticSort :: forall (s :: Sort). SingI s => DynamicSort -> Maybe (Sing s)
- toStaticallySorted :: forall d (s :: Sort). SingI s => DynamicallySorted d -> Maybe (d s)
Documentation
A universe of recognized sorts
Constructors
BooleanSort | booleans (true, false) |
IntegralSort | integers (..., -1, 0, 1, ...) |
ArraySort | arrays indexed by |
Instances
data family Sing (a :: k) :: Type #
The singleton kind-indexed data family.
Instances
data Sing (a :: Bool) | |
data Sing (a :: Ordering) | |
data Sing (n :: Nat) | |
data Sing (n :: Symbol) | |
Defined in Data.Singletons.TypeLits.Internal | |
data Sing (a :: ()) | |
Defined in Data.Singletons.Prelude.Instances | |
data Sing (a :: Void) | |
Defined in Data.Singletons.Prelude.Instances | |
data Sing (a :: All) | |
data Sing (a :: Any) | |
data Sing (a :: Sort) Source # | |
Defined in Data.Expression.Sort data Sing (a :: Sort) where
| |
data Sing (b :: [a]) | |
data Sing (b :: Maybe a) | |
data Sing (b :: Min a) | |
data Sing (b :: Max a) | |
data Sing (b :: First a) | |
data Sing (b :: Last a) | |
data Sing (a :: WrappedMonoid m) | |
Defined in Data.Singletons.Prelude.Semigroup.Internal data Sing (a :: WrappedMonoid m) where
| |
data Sing (b :: Option a) | |
data Sing (b :: Identity a) | |
data Sing (b :: First a) | |
data Sing (b :: Last a) | |
data Sing (b :: Dual a) | |
data Sing (b :: Sum a) | |
data Sing (b :: Product a) | |
data Sing (b :: Down a) | |
data Sing (b :: NonEmpty a) | |
data Sing (b :: Endo a) | |
data Sing (b :: MinInternal a) | |
Defined in Data.Singletons.Prelude.Foldable data Sing (b :: MinInternal a) where
| |
data Sing (b :: MaxInternal a) | |
Defined in Data.Singletons.Prelude.Foldable data Sing (b :: MaxInternal a) where
| |
data Sing (c :: Either a b) | |
data Sing (c :: (a, b)) | |
data Sing (c :: Arg a b) | |
data Sing (f :: k1 ~> k2) | |
data Sing (b :: StateL s a) | |
data Sing (b :: StateR s a) | |
data Sing (d :: (a, b, c)) | |
data Sing (c :: Const a b) | |
data Sing (e :: (a, b, c, d)) | |
data Sing (f :: (a, b, c, d, e)) | |
data Sing (g :: (a, b, c, d, e, f)) | |
Defined in Data.Singletons.Prelude.Instances | |
data Sing (h :: (a, b, c, d, e, f, g)) | |
Defined in Data.Singletons.Prelude.Instances |
withSort :: forall a (s :: Sort). Sing s -> (SingI s => a) -> a Source #
Turn implicit sort parameter into explicit one
data DynamicSort where Source #
Some sort (obtained for example during parsing)
Constructors
DynamicSort :: forall (s :: Sort). Sing s -> DynamicSort |
Instances
Eq DynamicSort Source # | |
Defined in Data.Expression.Sort |
data DynamicallySorted (d :: Sort -> *) where Source #
A value of some sort
Constructors
DynamicallySorted :: forall (s :: Sort) d. Sing s -> d s -> DynamicallySorted d |
Instances
(forall (s :: Sort). Eq (d s)) => Eq (DynamicallySorted d) Source # | |
Defined in Data.Expression.Sort Methods (==) :: DynamicallySorted d -> DynamicallySorted d -> Bool # (/=) :: DynamicallySorted d -> DynamicallySorted d -> Bool # | |
(forall (s :: Sort). Show (d s)) => Show (DynamicallySorted d) Source # | |
Defined in Data.Expression.Sort Methods showsPrec :: Int -> DynamicallySorted d -> ShowS # show :: DynamicallySorted d -> String # showList :: [DynamicallySorted d] -> ShowS # |
type DynamicallySortedFix f = DynamicallySorted (IFix f) Source #
An expression of some sort (obtained for example during parsing)
parseSort :: Parser DynamicSort Source #
Parser that accepts sort definitions such as bool
, int
, array int int
, array int (array ...)
.
toDynamicallySorted :: forall d (s :: Sort). SingI s => d s -> DynamicallySorted d Source #
Converts a statically sorted expression to a dynamically sorted one.
toStaticSort :: forall (s :: Sort). SingI s => DynamicSort -> Maybe (Sing s) Source #
Tries to convert some sort (DynamicSort
) to a requested sort.
toStaticallySorted :: forall d (s :: Sort). SingI s => DynamicallySorted d -> Maybe (d s) Source #
Tries to convert an expression (DynamicallySorted
) of some sort to an expression of requested sort.
Performs no conversions.