开发者

How to Convert Type in Tuples

开发者 https://www.devze.com 2022-12-23 02:11 出处:网络
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

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)
ERRO开发者_StackOverflow中文版R - Cannot infer instance
*** Instance   : Num [Char]
*** Expression : tupletotuple ("cha",4,3)


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

0

精彩评论

暂无评论...
验证码 换一张
取 消