Closed lastland closed 6 years ago
Change f
to:
f :: Int -> Int
f x | True = 1
| otherwise = 2
and hs-to-coq
still fails to translate f
.
But hs-to-coq
can successfully translate the following f
:
f :: Int -> Int
f x | x == 1 = 1
f _ = 2
Code for translating pattern matches with guards is here https://github.com/antalsz/hs-to-coq/blob/master/src/lib/HsToCoq/ConvertHaskell/Expr.hs
I have created a minimal example that can reproduce this bug under
examples/guard
.The Haskell file contains the following three functions:
hs-to-coq
fails to translatef
.It can translate
g
but the translated Coq file cannot be compiled (because the translated code uses==
, which is a notation must be imported fromGHC.Base
).It can successfully translate
h
.