File tree 5 files changed +41
-2
lines changed
liquidhaskell-boot/src/Language/Haskell/Liquid/Transforms
5 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ library
25
25
Language.Haskell.Liquid.Equational
26
26
Language.Haskell.Liquid.Bag
27
27
Language.Haskell.Liquid.ProofCombinators
28
- KMeansHelper
29
28
hs-source-dirs : src
30
29
build-depends : base < 5
31
30
, ghc-prim
Original file line number Diff line number Diff line change @@ -249,7 +249,21 @@ stitch γ e
249
249
e' <- normalize γ e
250
250
bs <- st_binds <$> get
251
251
put bs'
252
- return $ mkCoreLets bs e'
252
+ -- See Note [Shape of normalized terms]
253
+ let (tvs, e'') = collectTyBinders e'
254
+ return $ mkLams tvs (mkCoreLets bs e'')
255
+
256
+ -- Note [Shape of normalized terms]
257
+ --
258
+ -- The termination checker in Termination.collectArguments expects the type
259
+ -- binders to come before lets:
260
+ --
261
+ -- > \ (@a) -> let ... in \ b c d -> ...
262
+ --
263
+ -- Therefore, stitch makes sure to insert new lets after the type binders
264
+ --
265
+ -- > \ (@a) -> let lqanf... = ... in let ... in \ b c d -> ...
266
+ --
253
267
254
268
_mkCoreLets' :: [CoreBind ] -> CoreExpr -> CoreExpr
255
269
_mkCoreLets' bs e = mkCoreLets bs1 e1
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ {-# OPTIONS_GHC -ddump-ds #-}
2
+ -- | Tests that liquid haskell can deal fine with HasCallStack.
3
+ --
4
+ -- See https://github.com/ucsd-progsys/liquidhaskell/issues/2235
5
+ module T2235 where
6
+
7
+ import Language.Haskell.Liquid.Prelude (liquidError )
8
+ import GHC.Stack
9
+
10
+ {-@ myhead :: {xs:[a ] | len xs > 0 } -> a @-}
11
+ myhead :: HasCallStack => [a ] -> a
12
+ myhead (x: _) = x
13
+
14
+ {-@ type PosInt = {v: Int | v > 0 } @-}
15
+ {-@ type List a N = {v : [a ] | (len v) = N } @-}
16
+ {-@ type Matrix a Rows Cols = (List (List a Cols ) Rows ) @-}
17
+ {-@ transpose :: c:Int -> r:PosInt -> Matrix a r c -> Matrix a c r @-}
18
+
19
+ transpose :: Int -> Int -> [[a ]] -> [[a ]]
20
+ transpose 0 _ _ = []
21
+ transpose c r ((x: xs) : xss) = (x : map myhead xss) : transpose (c- 1 ) r (xs : map tail xss)
22
+ transpose c r ([] : _) = liquidError " dead code"
23
+ transpose c r [] = error " dead code"
24
+
Original file line number Diff line number Diff line change @@ -1614,6 +1614,7 @@ executable unit-pos-1
1614
1614
, T2091
1615
1615
, T2093
1616
1616
, T2096
1617
+ , T2235
1617
1618
, T385
1618
1619
, T531
1619
1620
, T595a
@@ -1901,6 +1902,7 @@ executable unit-pos-2
1901
1902
, Ite1
1902
1903
, Ite
1903
1904
, Jeff
1905
+ , KMeansHelper
1904
1906
, Keys
1905
1907
, Kmp
1906
1908
, KmpIO
You can’t perform that action at this time.
0 commit comments