universum-1.2.0: Custom prelude used in Serokell

Safe HaskellSafe
LanguageHaskell2010

Universum.TypeOps

Description

Type operators for writing convenient type signatures.

Synopsis

Documentation

type family Each (c :: [k -> Constraint]) (as :: [k]) where ... Source #

Map several constraints over several variables.

f :: Each [Show, Read] [a, b] => a -> b -> String
=
f :: (Show a, Show b, Read a, Read b) => a -> b -> String

To specify list with single constraint / variable, don't forget to prefix it with ':

f :: Each '[Show] [a, b] => a -> b -> String

Equations

Each c '[] = (() :: Constraint) 
Each c (h ': t) = (c <+> h, Each c t) 

type With a b = a <+> b Source #

Map several constraints over a single variable. Note, that With a b ≡ Each a '[b]

a :: With [Show, Read] a => a -> a
=
a :: (Show a, Read a) => a -> a

type ($) k k1 (f :: k -> k1) (a :: k) = f a infixr 2 #

Infix application.

f :: Either String $ Maybe Int
=
f :: Either String (Maybe Int)