Lysxia / first-class-families

First-class type families
https://hackage.haskell.org/package/first-class-families
MIT License
86 stars 12 forks source link

Add LiftM, LiftM2, LiftM3 #3

Closed blmage closed 5 years ago

blmage commented 5 years ago

Thanks for this great extension! I can already see a lot of places where I will most likely - and happily - use it :)

Here is an example of where I found LiftM2 useful:

import Fcf
import GHC.TypeNats (type (<=?), Div, Nat)

data NatSize :: Nat -> Exp Nat
type instance Eval (NatSize n) =
    Eval (UnBool (LiftM2 (+) (Pure 1) (NatSize (Div n 10))) (Pure 1) (n <=? 9))
Lysxia commented 5 years ago

Thanks! That looks good! I'll make a release next week.