generic-data-1.1.0.2: Deriving instances with GHC.Generics and related utilities

Safe Haskell | Trustworthy
Language | Haskell2010

Generic.Data.Internal.Utils

Description

Utilities.

### Warning

This is an internal module: it is not subject to any versioning policy, breaking changes can happen at any time.

If something here seems useful, please report it or create a pull request to export it from an external module.

Synopsis

- gcoerce :: (Generic a, Generic b, Coercible (Rep a) (Rep b)) => a -> b
- gcoerceBinop :: (Generic a, Generic b, Coercible (Rep a) (Rep b)) => (a -> a -> a) -> b -> b -> b
- coerce' :: forall {k} f (x :: k) g. Coercible (f x) (g x) => f x -> g x
- coerce1 :: forall {k} f g (x :: k). Coercible f g => f x -> g x
- absurd1 :: forall {k} (x :: k) a. V1 x -> a
- from' :: Generic a => a -> Rep a ()
- to' :: Generic a => Rep a () -> a
- liftG2 :: forall {k} f (a :: k) (b :: k) (c :: k). Generic1 f => (Rep1 f a -> Rep1 f b -> Rep1 f c) -> f a -> f b -> f c
- isSymDataCon :: String -> Bool
- isSymVar :: String -> Bool

# Documentation

gcoerce :: (Generic a, Generic b, Coercible (Rep a) (Rep b)) => a -> b Source #

Convert between types with representationally equivalent generic representations.

gcoerceBinop :: (Generic a, Generic b, Coercible (Rep a) (Rep b)) => (a -> a -> a) -> b -> b -> b Source #

Compose `gcoerce` with a binary operation.

coerce' :: forall {k} f (x :: k) g. Coercible (f x) (g x) => f x -> g x Source #

Coerce while preserving the type index.

coerce1 :: forall {k} f g (x :: k). Coercible f g => f x -> g x Source #

absurd1 :: forall {k} (x :: k) a. V1 x -> a Source #

Elimination of `V1`.

from' :: Generic a => a -> Rep a () Source #

A helper for better type inference.

to' :: Generic a => Rep a () -> a Source #

A helper for better type inference.

liftG2 :: forall {k} f (a :: k) (b :: k) (c :: k). Generic1 f => (Rep1 f a -> Rep1 f b -> Rep1 f c) -> f a -> f b -> f c Source #

Lift binary combinators generically.

isSymDataCon :: String -> Bool Source #

Returns `True` if the argument is a symbolic data constructor name (e.g., `(:+:)`). Returns `False` otherwise.

isSymVar :: String -> Bool Source #

Returns `True` if the argument is a symbolic value name (e.g., `(+++)`). Returns `False` otherwise.