[Haskell-cafe] symbol type?

Yitzchak Gale gale at sefer.org
Wed Oct 10 04:00:46 EDT 2007


Michael Vanier wrote:
>> Is there an implementation of a symbol type in Haskell i.e. a string which
>> has a constant-time comparison operation?

Stefan O'Rear wrote:
> Yes, I beleive GHC uses one (utils/FastString.lhs iirs)

In some cases where you would need that in other languages,
you would use an algebraic data type in Haskell, e.g.:

data Color = Red | Orange | Yellow | Green | Blue | Purple
  deriving (Eq, Show)

-Yitz


More information about the Haskell-Cafe mailing list