 | SybWidget-0.5.0: Library which aids constructing generic (SYB3-based) widgets | Contents | Index |
|
| Graphics.UI.SybWidget.InstanceCreator |
|
|
| Description |
| Contains functions to automatically create instances from
data type definitions.
|
|
| Synopsis |
|
| gGenUpTo :: forall a ctx. Data ctx a => Proxy ctx -> Int -> [a] | | | createInstance :: forall a ctx. Data ctx a => Proxy ctx -> Maybe a | | | createInstance' :: forall a ctx. Data ctx a => Proxy ctx -> a -> Maybe a | | | instanceFromConstr :: forall a ctx. Data ctx a => Proxy ctx -> Constr -> Maybe a |
|
|
| Documentation |
|
| gGenUpTo |
| :: forall a ctx . Data ctx a | | | => Proxy ctx | | | -> Int | Max number of recursions
| | -> [a] | | Generates all possible instances of a, while using no more
than n levels of recursion. Each subtype requires another level
of recursion. For example:
Branch (Branch Leaf 17) (Leaf 3)
would require 4 levels of recursion. One for the first branch,
one for second branch, one for the left Leaf, and one for the
Int (the seventeen). The right part of the first branch (Left
3) would be done in two recursions.
|
|
|
| createInstance :: forall a ctx. Data ctx a => Proxy ctx -> Maybe a |
| Creates an instance of a Haskell type. For this to work the compiler
must be able to deduce the type from the callee's context.
|
|
| createInstance' :: forall a ctx. Data ctx a => Proxy ctx -> a -> Maybe a |
| Like createInstance excepts it uses a phantom type to elicit the
correct type to return.
|
|
| instanceFromConstr |
| :: forall a ctx . Data ctx a | | | => Proxy ctx | | | -> Constr | | | -> Maybe a | Returns Nothing if it was not possible to create the value.
| | Creates an instance with a specific constructor.
|
|
|
| Produced by Haddock version 2.1.0 |