Why is Nat type equal to Int in Liquid Haskell?

369 views Asked by At

Why does this pass Liquid Haskell verification?

{-@ sub :: Nat -> Nat -> Int @-}                                                                                                         
sub :: Int -> Int -> Int 
sub i j = i - j 

Does it mean that Nat is the same as Int from LH's point of view?

1

There are 1 answers

0
Daniel Wagner On BEST ANSWER

Suppose you say to me, "Hey, I'd like an apple!". I reply: "Sorry, I only have red apples.". You're going to look at me pretty funny, huh? A red apple is an apple!

If a function asks for an Int as an argument, it's no problem to hand it an Int that you know is not negative.