[Haskell-cafe] variable definition according to input

Henning Thielemann lemming at henning-thielemann.de
Sun Sep 5 15:36:42 EDT 2010

On Sun, 5 Sep 2010, Maria Merit wrote:

> Hello,
> Is it possible to define variable names according to input data? For instance:
> input = "I k"    => Int k
> input = "I m"    => Int m
> input = "S s"    => String s

No this is not possible. However you can use
  Data.Map String Object
  data Object = Int Int | String String
in order to manage a set of variables, that is their names and their 

More information about the Haskell-Cafe mailing list