File: expr1.dhall

package info (click to toggle)
haskell-dhall 1.42.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 23,784 kB
  • sloc: haskell: 24,804; makefile: 3
file content (15 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  λ(a : Type)
→ let ExprF =
        < LitF : Natural
        | AddF : { _1 : a, _2 : a }
        | MulF : { _1 : a, _2 : a }
        >

  in    λ(a : ExprF → a)
      → let Lit = λ(x : Natural) → a (ExprF.LitF x)

        let Add = λ(x : a@1) → λ(y : a@1) → a (ExprF.AddF { _1 = x, _2 = y })

        let Mul = λ(x : a@1) → λ(y : a@1) → a (ExprF.MulF { _1 = x, _2 = y })

        in  Add (Mul (Lit 3) (Lit 7)) (Add (Lit 1) (Lit 2))