Find type synonyms in haskell

Is there a way to look at what type synonyms mean? Maybe some GHCi command that I can use to see if this type is synonymous with something else?

+4
source share
1 answer

Yes, in GHCi you can use :info:

Prelude> :info String
type String = [Char]    -- Defined in ‘GHC.Base’
Prelude>

EDIT and other examples, including an example with an alias:

Prelude> :info Rational
type Rational = GHC.Real.Ratio Integer  -- Defined in ‘GHC.Real’
Prelude> :i Double
data Double = GHC.Types.D# GHC.Prim.Double#
        -- Defined in ‘GHC.Types’
+8
source

Source: https://habr.com/ru/post/1694792/


All Articles