Find constraints over type

Alejandro Serrano Mena trupill at gmail.com
Thu Jan 16 16:19:09 UTC 2020


Dear GHC devs,
I am trying to figure out a way to obtain the constraints that hold over a
type. Let me give you an example: suppose that I write the following
function:

f :: Eq a => [a] -> Bool
f xs = xs == []

If I ask for the type of the Var ' xs', I get back '[a]'. This is correct,
but I am missing the crucial information that '[a]' must be Eq.

Is there an easy way to get it? It seems that 'varType' doesn't give me
enough information.

Regards,
Alejandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200116/a9d338f9/attachment.html>


More information about the ghc-devs mailing list