Home > Software engineering >  Convert a MOSCOW ML type to HASKELL
Convert a MOSCOW ML type to HASKELL

Time:05-27

I'm trying to convert a SML type to a Haskell type.

type Identifier = string

type 'a Environment = (Identifier * 'a) list

CodePudding user response:

I guess the same code in Haskell could be

type Identifier = String

type Environment a = [(Identifier, a)]

Still, I would recommend to use newtypes to increase type safety, like in

newtype Identifier = Identifier String

newtype Environment a = Environment [(Identifier, a)]
  • Related