-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type level nat parameter causes LH to check less #2457
Comments
Hey @kleinreact! I cannot really run this code, because LH gives me too many errors before the liquidhaskell/tests/pos/TypeLitNat.hs Line 4 in 8407040
Concretely, the below seems correct for me (i.e.,
|
Oh, I'm sry, I should have added more context on my setup. Here's the options and imports that work for me: {-@ LIQUID "" @-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# OPTIONS_GHC -fplugin=LiquidHaskell #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-@ LIQUID "--prune-unsorted" @-}
module Liquid.Test where
import Prelude
import GHC.Base (Type)
import GHC.TypeNats (Nat, Natural)
{-@ embed Natural as Int @-}
...
Yes, but in your case the p3 :: P 10
p3 = 3 + 9 instead of p3 :: P 10
p3 = P (3 + 9) That's exactly where the behavior differs between the |
Thanks to @nikivazou we also got the reproducer working with 791567f. I updated the code above accordingly. After the update the code now produces multiple
caused by using the |
Lets say I wanna have a bounded number type with
Num
capabilities, then I can get that for some fixed lower bound 0 and upper bound 9 as follows:LH checks the bounds in this case as expected.
However, if I parameterize the bound using a type level natural instead, e.g.
then the last definition of
p3
LH type checks, although it shouldn't. Note that only change here is the additionally introduced type level nat parameter.I'd expect the parameterized version to behave the same as the non-parameterized one in this case.
Tested with GHC 9.10 and 8c550df.
2024-12-17: Update of the reproducer to work with 791567f.
The text was updated successfully, but these errors were encountered: