[Haskell-cafe] symbol type?

Michael Vanier mvanier at cs.caltech.edu
Wed Oct 10 04:03:49 EDT 2007


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


More information about the Haskell-Cafe mailing list