should-not-typecheck
should-not-typecheck copied to clipboard
shouldNotTypecheck not catching some deferred type errors
I've found some cases where shouldNotTypecheck
fails to capture the deferred type errors. The full error is documented here, but in short, what seems to be happening is:
-
I've got an expression
fromNatSingToZ (SuccSing ZeroSing) :: Z 'Zero
that fails to typecheck due to a missing instance -shouldNotTypecheck
does capture the deferred type error. -
when I pass that expression to a function
fromZToF (fromNatSingToZ (SuccSing ZeroSing))
wherefromZToF :: Z 'Zero -> F
,shouldNotTypecheck
does not capture the deferred type error. It suggests I make sure the expression has a NFData instance, whichF
does.
There's some other weird behaviour going on:
- if I rename
fromNatSingToZ
totoZ
,shouldNotTypecheck
does capture the deferred type error above, but doesn't capture the deferred type error thrown byfromNatSingToF (SuccSing ZeroSing))
wherefromNatSingToF = fromZToF . fromNatSingToZ
- if I rename the type
F
toX
orG
, all the above deferred type errors are captured - if I move the module that defines the test from
Data/BugSpec.hs
toBugSpec.hs
, all the above deferred type errors are captured.