Created
January 7, 2021 03:20
-
-
Save rybla/833e773031d6eff867403ac01b945471 to your computer and use it in GitHub Desktop.
[Liquid Haskell] Problem with naming record fields for List data type.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ListFailure where | |
import Prelude hiding ( head | |
, tail | |
) | |
{-@ | |
data List a = Nil | Cons { head :: a , tail :: List a } | |
@-} | |
data List a = Nil | Cons { head :: a , tail :: List a } | |
{- | |
This file failes to compile with: | |
> liquid ListFailure.hs | |
Yields this error: | |
10 | data List a = Nil | Cons { head :: a , tail :: List a } | |
^^^^^ | |
ListFailure.head :: forall a . | |
lq$recSel:(ListFailure.List a) -> {VV : a | VV == head lq$recSel} | |
Sort Error in Refinement: {VV : a##xo | VV == head lq$recSel} | |
Cannot unify fix$36$$91$$93$ with ListFailure.List in expression: head lq$recSel | |
/Users/henry/Documents/Prototypes/liquidhaskell/list-fields-bug/ListFailure.hs:12:21-55: Error: Illegal type specification for `ListFailure.Cons` | |
12 | data List a = Nil | Cons { head :: a , tail :: List a } | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
ListFailure.Cons :: forall a . | |
head:a -> tail:(ListFailure.List a) -> {VV : (ListFailure.List a) | tail VV == tail | |
&& head VV == head} | |
Sort Error in Refinement: {VV : (ListFailure.List a##agi) | (tail VV == tail##ListFailure.Cons | |
&& head VV == head##ListFailure.Cons)} | |
Cannot unify fix$36$$91$$93$ with ListFailure.List in expression: tail VV | |
Using: LiquidHaskell Version 0.8.6.0. | |
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ListSuccess where | |
import Prelude hiding ( head | |
, tail | |
) | |
{-@ | |
data List a = Nil | Cons { lh :: a , lt :: List a } | |
@-} | |
data List a = Nil |Cons { lh :: a , lt :: List a } | |
{- | |
This file complies successfully with: | |
> liquid ListSuccess.hs | |
Using: LiquidHaskell Version 0.8.6.0. | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment