servant-checked-exceptions-1.1.0.0: Checked exceptions for Servant APIs.

CopyrightDennis Gosnell 2017
LicenseBSD3
MaintainerDennis Gosnell (cdep.illabout@gmail.com)
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe
LanguageHaskell2010

Servant.Checked.Exceptions.Internal.Util

Description

Additional helpers.

Synopsis

Documentation

type family Snoc (as :: [k]) (b :: k) where ... Source #

A type-level snoc.

Append to an empty list:

>>> Refl :: Snoc '[] Double :~: '[Double]
Refl

Append to a non-empty list:

>>> Refl :: Snoc '[Char] String :~: '[Char, String]
Refl

Equations

Snoc '[] b = '[b] 
Snoc (a ': as) b = a ': Snoc as b 

type family ReturnX x as where ... Source #

Change a list of types into a list of functions that take the given type and return x.

>>> Refl :: ReturnX Double '[String, Int] :~: '[String -> Double, Int -> Double]
Refl

Don't do anything with an empty list:

>>> Refl :: ReturnX Double '[] :~: '[]
Refl

Equations

ReturnX x (a ': as) = (a -> x) ': ReturnX x as 
ReturnX x '[] = '[] 
>>> import Data.Type.Equality ((:~:)(Refl))