strongweak-0.1.0: Convert between strong and weak representations of types
Safe HaskellSafe-Inferred
LanguageHaskell2010

Strongweak.SW

Synopsis

Documentation

data Strength Source #

Constructors

Strong 
Weak 

type family Weak (a :: Type) :: Type Source #

Obtain the weak representation of the given type.

Instances

Instances details
type Weak Int16 Source # 
Instance details

Defined in Strongweak.SW

type Weak Int32 Source # 
Instance details

Defined in Strongweak.SW

type Weak Int64 Source # 
Instance details

Defined in Strongweak.SW

type Weak Int8 Source # 
Instance details

Defined in Strongweak.SW

type Weak Word16 Source # 
Instance details

Defined in Strongweak.SW

type Weak Word32 Source # 
Instance details

Defined in Strongweak.SW

type Weak Word64 Source # 
Instance details

Defined in Strongweak.SW

type Weak Word8 Source # 
Instance details

Defined in Strongweak.SW

type Weak (Refined p a) Source # 
Instance details

Defined in Strongweak.SW

type Weak (Refined p a) = a
type Weak (Vector n a) Source # 
Instance details

Defined in Strongweak.SW

type Weak (Vector n a) = [a]

type family SW (s :: Strength) a :: Type where ... Source #

Obtain either the strong or weak representation of a type, depending on the type-level strength "switch" provided.

This is intended to be used in data types that take a Strength type. Define your type using strong fields wrapped in Switch s. You then get the weak representation for free, using the same definition.

data A (s :: Strength) = A
  { aField1 :: Switch s Word8
  , aField2 :: String }

Equations

SW 'Strong a = a 
SW 'Weak a = Weak a