serv-wai-0.2.0.0: Dependently typed API servers with Serv

Safe HaskellNone
LanguageHaskell2010

Serv.Wai.Corec

Description

Co-records are sum types over an extensible set of options.

Synopsis

Documentation

data Corec f rs where Source

A Corec f rs is a value f (r, s) for exactly one choice of r and s such that (r, s) is an element of rs.

Constructors

Skip :: Corec f rs -> Corec f (`(r, s)` : rs) 
Stop :: f `(r, s)` -> Corec f (`(r, s)` : rs) 

class ElemOf rs x where Source

The judgement ElemOf rs (r, s) is satisified when there's an equality between (r, s) and some element of rs. More than this, however, we assume that the first match of r in rs will work and then defer matching the s component until later. This helps inference so long as the assumption that r is "index-like" holds

Methods

inject :: f x -> Corec f rs Source

Given a valid variant of a Corec "forget" its identity into the larger Corec.

Instances

ElemOf k k1 rs ((,) k k1 r s) => ElemOf k k ((:) ((,) k k) ((,) k k r' s') rs) ((,) k k r s) Source 
(~) k1 s' s => ElemOf k k ((:) ((,) k k) ((,) k k r s) rs) ((,) k k r s') Source