on db148ff help sign in
rel8/src/Rel8/Kind/Algebra.hs
38 lines 721 B history raw
1{-# language DataKinds #-}
2{-# language FlexibleContexts #-}
3{-# language GADTs #-}
4{-# language StandaloneKindSignatures #-}
6module Rel8.Kind.Algebra
7 ( Algebra( Product, Sum )
8 , SAlgebra( SProduct, SSum )
9 , KnownAlgebra( algebraSing )
10 )
11where
13-- base
14import Data.Kind ( Constraint, Type )
15import Prelude ()
18type Algebra :: Type
19data Algebra = Product | Sum
22type SAlgebra :: Algebra -> Type
23data SAlgebra algebra where
24 SProduct :: SAlgebra 'Product
25 SSum :: SAlgebra 'Sum
28type KnownAlgebra :: Algebra -> Constraint
29class KnownAlgebra algebra where
30 algebraSing :: SAlgebra algebra
33instance KnownAlgebra 'Product where
34 algebraSing = SProduct
37instance KnownAlgebra 'Sum where
38 algebraSing = SSum