lude

Haskell prelude alternative
git clone git://git.rr3.xyz/lude | git clone gits://git.rr3.xyz/lude
Log | Files | Refs | README | LICENSE

Kind.hs (882B)


      1 module Lude.Haskell.Kind (
      2     KindOrType#,
      3     KindOrType,
      4     Kind,
      5     Endo,
      6     Biendo,
      7 ) where
      8 
      9 import GHC.Exts qualified as GHC
     10 
     11 import Lude.Haskell.Repr (Repr)
     12 import Lude.Haskell.Repr qualified as Repr
     13 
     14 --------------------------------------------------------------------------------
     15 
     16 -- This is just so @Kind@ itself receives a non-confusing kind in GHC
     17 -- diagnostic messages
     18 type KIND = GHC.TYPE Repr.BoxL
     19 
     20 -- NOTE: We typically avoid conflating types and kinds for clarity,
     21 -- but when we do conflate them, we use KindOrType.
     22 
     23 type KindOrType# :: Repr -> KIND
     24 type KindOrType# = GHC.TYPE
     25 
     26 type KindOrType :: KIND
     27 type KindOrType = KindOrType# Repr.BoxL
     28 
     29 type Kind :: KIND
     30 type Kind = KindOrType
     31 
     32 type Endo :: forall (r :: Repr). KindOrType# r -> KindOrType
     33 type Endo i = i -> i
     34 
     35 type Biendo :: forall (r :: Repr). KindOrType# r -> KindOrType
     36 type Biendo i = i -> i -> i