agda2hs icon indicating copy to clipboard operation
agda2hs copied to clipboard

Add a primitive `Let` that is compiled to `let` in Haskell

Open jespercockx opened this issue 1 year ago • 2 comments

jespercockx avatar Dec 11 '23 14:12 jespercockx

May I suggest having a cursed syntax:

infixr 5 Let
syntax Let a (λ x → b) = let[ x ← a ] b

t : Bool
t =
  let[ x ← True  ]
  let[ y ← False ]
  x || y

flupe avatar Dec 13 '23 13:12 flupe

Note: Haskell's let bindings are always recursive, so we should make sure that the name used in the Let does not appear in the expression being bound to prevent incorrect behavior.

flupe avatar Dec 13 '23 13:12 flupe