
10 Oct
2007
10 Oct
'07
8:03 a.m.
I'm thinking of a symbol type that can be used for a compiler, so a simple algebraic data type wouldn't work. Unfortunately the GHC datatype isn't part of the GHC haskell libraries AFAICT. Mike Yitzchak Gale wrote:
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