Skip to content

Commit 94fe276

Browse files
committed
Fix possible bug in compact lambdas
1 parent f02db51 commit 94fe276

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lapse.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 3.0
22
name: lapse
3-
version: 2.0.4
3+
version: 2.0.5
44
license: GPL-3.0-only
55
license-file: LICENSE
66
author: ProggerX

src/Lapse/Lambda.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Lapse.Lambda where
44

55
import Control.Monad ((<=<))
66
import Control.Monad.State (get, gets, put)
7-
import Data.List (sort)
7+
import Data.List (group, sort)
88
import Data.Map.Strict (empty, fromList)
99
import Lapse.Eval (eval)
1010
import Lapse.Operators (lset)
@@ -93,6 +93,6 @@ findFree = \case
9393

9494
compact :: Func
9595
compact v = do
96-
freeVars <- sort <$> findFree v
96+
freeVars <- (map head . group) . sort <$> findFree v
9797
let args = foldr (Pair . Name) Nil freeVars
9898
Function <$> mkFunction args v

0 commit comments

Comments
 (0)