Nubkadiya
Nubkadiya

Reputation: 3465

How to Convert Type in Tuples

how to convert a String type to a Int

i have a tuple and i want to convert it to a tuple which has different types

tupletotuple :: (String,String,String) ->(String,Int,Int)
tupletotuple (a,b,c) = (a,read(b),read(c))

i get this Error Msg

Project> tupletotuple ("cha",4,3)
ERROR - Cannot infer instance
*** Instance   : Num [Char]
*** Expression : tupletotuple ("cha",4,3)

Upvotes: 0

Views: 207

Answers (1)

stefaanv
stefaanv

Reputation: 14392

You need a tuple of 3 strings to convert. The result will be a string and 2 ints.

Upvotes: 2

Related Questions