[Haskell-cafe] Learn You a Haskell for Great Good - a few doubts
Karthick Gururaj
karthick.gururaj at gmail.com
Thu Mar 3 15:49:00 CET 2011
On Thu, Mar 3, 2011 at 8:00 PM, Paul Sujkov <psujkov at gmail.com> wrote:
> Hi,
> you can always check the types using GHCi prompt:
> *Prelude> :i (,)
> data (,) a b = (,) a b -- Defined in GHC.Tuple
> instance (Bounded a, Bounded b) => Bounded (a, b)
> -- Defined in GHC.Enum
> instance (Eq a, Eq b) => Eq (a, b) -- Defined in Data.Tuple
> instance Functor ((,) a) -- Defined in Control.Monad.Instances
> instance (Ord a, Ord b) => Ord (a, b) -- Defined in Data.Tuple
> instance (Read a, Read b) => Read (a, b) -- Defined in GHC.Read
> instance (Show a, Show b) => Show (a, b) -- Defined in GHC.Show
> that's for a tuple. You can see that tuple has an instance for the Ord
> class.
> *Prelude> :i ()
> data () = () -- Defined in GHC.Unit
> instance Bounded () -- Defined in GHC.Enum
> instance Enum () -- Defined in GHC.Enum
> instance Eq () -- Defined in Data.Tuple
> instance Ord () -- Defined in Data.Tuple
> instance Read () -- Defined in GHC.Read
> instance Show () -- Defined in GHC.Show
> and that's for a unit type.
> [snip]
Ah, thanks! I didn't know about :i, tried only :t () which didn't give
very interesting information.
More information about the Haskell-Cafe
mailing list