[Haskell-beginners] Is there a way to hide an existing data type so that I can use my own version?

Costello, Roger L. costello at mitre.org
Tue Jul 31 13:08:38 CEST 2012


Hi Folks,

For learning purposes, I created an "Either" data type:

data Either a b = Left a | Right b
                           deriving (Show)

However, when I try to use Left (or Right), I get an error message saying that it is ambiguous whether I am using Prelude.Left or Main.Left

So I tried hiding Prelude.Either like so:

import Prelude hiding Either

But that produced an error.

Is there a way to hide the existing Either data type so that I can use my own version?

/Roger



More information about the Beginners mailing list