Error about “type signature with no binding”

后端 未结 2 671
予麋鹿
予麋鹿 2021-01-29 12:25

I have a problem with ASCII in Haskell.

fromEnum :: Char -> Int
toEnum :: Int -> Char

offset :: Int
offset = fromEnum \'A\' - fromEnum \'a\'

toUpper ::          


        
2条回答
  •  抹茶落季
    2021-01-29 12:45

    fromEnum and toEnum are standart functions

    please try this:

    offset :: Int
    offset = fromEnum 'A' - fromEnum 'a'
    
    toUpper :: Char -> Char
    toUpper ch = toEnum (fromEnum ch + offset)
    

提交回复
热议问题