| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
SizedGrid
Contents
Synopsis
- module SizedGrid.Ordinal
- module SizedGrid.Grid.Grid
- module SizedGrid.Grid.Focused
- module SizedGrid.Grid.Class
- module SizedGrid.Coord.Periodic
- module SizedGrid.Coord.HardWrap
- module SizedGrid.Coord.Class
- module SizedGrid.Coord
- class (AllF c xs, SListI xs) => All (c :: k -> Constraint) (xs :: [k])
- type SListI = All (Top :: k -> Constraint)
- class f (g x) => Compose (f :: k -> Constraint) (g :: k1 -> k) (x :: k1)
- newtype I a = I a
Documentation
module SizedGrid.Ordinal
module SizedGrid.Grid.Grid
module SizedGrid.Grid.Focused
module SizedGrid.Grid.Class
module SizedGrid.Coord.Periodic
module SizedGrid.Coord.HardWrap
module SizedGrid.Coord.Class
module SizedGrid.Coord
Rexported for generics-sop
class (AllF c xs, SListI xs) => All (c :: k -> Constraint) (xs :: [k]) #
Require a constraint for every element of a list.
If you have a datatype that is indexed over a type-level
list, then you can use All to indicate that all elements
of that type-level list must satisfy a given constraint.
Example: The constraint
All Eq '[ Int, Bool, Char ]
is equivalent to the constraint
(Eq Int, Eq Bool, Eq Char)
Example: A type signature such as
f :: All Eq xs => NP I xs -> ...
means that f can assume that all elements of the n-ary
product satisfy Eq.
Note on superclasses: ghc cannot deduce superclasses from All
constraints.
You might expect the following to compile
class (Eq a) => MyClass a foo :: (All Eq xs) => NP f xs -> z foo = [..] bar :: (All MyClass xs) => NP f xs -> x bar = foo
but it will fail with an error saying that it was unable to
deduce the class constraint (or similar) in the
definition of AllF Eq xsbar.
In cases like this you can use Dict from Data.SOP.Dict
to prove conversions between constraints.
See this answer on SO for more details.
Minimal complete definition
Instances
| All (c :: k -> Constraint) ([] :: [k]) | |
Defined in Data.SOP.Constraint Methods cpara_SList :: proxy c -> r [] -> (forall (y :: k0) (ys :: [k0]). (c y, All c ys) => r ys -> r (y ': ys)) -> r [] # | |
| (c x, All c xs) => All (c :: a -> Constraint) (x ': xs :: [a]) | |
Defined in Data.SOP.Constraint Methods cpara_SList :: proxy c -> r [] -> (forall (y :: k) (ys :: [k]). (c y, All c ys) => r ys -> r (y ': ys)) -> r (x ': xs) # | |
type SListI = All (Top :: k -> Constraint) #
Implicit singleton list.
A singleton list can be used to reveal the structure of a type-level list argument that the function is quantified over.
Since 0.4.0.0, this is now defined in terms of All.
A singleton list provides a witness for a type-level list
where the elements need not satisfy any additional
constraints.
Since: sop-core-0.4.0.0
class f (g x) => Compose (f :: k -> Constraint) (g :: k1 -> k) (x :: k1) infixr 9 #
Composition of constraints.
Note that the result of the composition must be a constraint,
and therefore, in , the kind of Compose f gf is k -> .
The kind of Constraintg, however, is l -> k and can thus be a normal
type constructor.
A typical use case is in connection with All on an NP or an
NS. For example, in order to denote that all elements on an
satisfy NP f xsShow, we can say .All (Compose Show f) xs
Since: sop-core-0.2
Instances
| f (g x) => Compose (f :: k2 -> Constraint) (g :: k1 -> k2) (x :: k1) | |
Defined in Data.SOP.Constraint | |
The identity type functor.
Like Identity, but with a shorter name.
Constructors
| I a |
Instances
| Monad I | |
| Functor I | |
| Applicative I | |
| Foldable I | |
Defined in Data.SOP.BasicFunctors Methods fold :: Monoid m => I m -> m # foldMap :: Monoid m => (a -> m) -> I a -> m # foldr :: (a -> b -> b) -> b -> I a -> b # foldr' :: (a -> b -> b) -> b -> I a -> b # foldl :: (b -> a -> b) -> b -> I a -> b # foldl' :: (b -> a -> b) -> b -> I a -> b # foldr1 :: (a -> a -> a) -> I a -> a # foldl1 :: (a -> a -> a) -> I a -> a # elem :: Eq a => a -> I a -> Bool # maximum :: Ord a => I a -> a # | |
| Traversable I | |
| Eq1 I | Since: sop-core-0.2.4.0 |
| Ord1 I | Since: sop-core-0.2.4.0 |
Defined in Data.SOP.BasicFunctors | |
| Read1 I | Since: sop-core-0.2.4.0 |
Defined in Data.SOP.BasicFunctors | |
| Show1 I | Since: sop-core-0.2.4.0 |
| NFData1 I | Since: sop-core-0.2.5.0 |
Defined in Data.SOP.BasicFunctors | |
| Eq a => Eq (I a) | |
| Ord a => Ord (I a) | |
| Read a => Read (I a) | |
| Show a => Show (I a) | |
| Generic (I a) | |
| Semigroup a => Semigroup (I a) | Since: sop-core-0.4.0.0 |
| Monoid a => Monoid (I a) | Since: sop-core-0.4.0.0 |
| NFData a => NFData (I a) | Since: sop-core-0.2.5.0 |
Defined in Data.SOP.BasicFunctors | |
| type Rep (I a) | |
Defined in Data.SOP.BasicFunctors | |
| type Code (I a) | |
Defined in Generics.SOP.Instances | |
| type DatatypeInfoOf (I a) | |
Defined in Generics.SOP.Instances | |