So I have my own data type in haskell defined like this:
data Token = Num Double | Op String
I want to make a function that converts a list of strings into a list of tokens. E.g.
toTokenList ["2","+","3"]
> [Num 2.0, Op "+", Num 3.0]
How would I go about doing this?
I have implemented a function that converts a type Double into a Token type and another one that converts a String to a Token type. Can these be used for toTokenList or no?
I am new to Haskell relatively and if you need further clarification about the question please let me know in the comments.