[Haskell-beginners] Showing Types

Dániel Arató exitconsole at gmail.com
Mon Mar 7 18:06:03 UTC 2016


How does GHCi show types?

Is there a magic function (showType :: a -> String) that does that? Or
is this feature buried somewhere deep in the compiler?

Can I show, compare and reason about types in a Haskell program?

This would be cool:

```haskell
test = do
let len = sum . map (const 1)
when (isInfixOf "Integer" (showType len)) $ putStrLn "restrictive type
inferred; maybe try turning off monomorphism restriction"
```


More information about the Beginners mailing list