[Haskell-cafe] Can't figure out how to "show" for type "Int -> (Int, Int)"

Marco Túlio Gontijo e Silva malebria at riseup.net
Thu Jan 11 09:55:59 EST 2007


Em Qui, 2007-01-11 às 06:37 -0800, Tom Titchener escreveu:
> ERROR - Cannot find "show" function for:
> 
> *** Expression : eval answer
> 
> *** Of type    : Int -> (Int,Int)

> type M a = State -> (a, State) -- higher-order type, e.g. function 
> type
> 
> type State = Int -- type synonym

So M a = Int -> (a, Int)

> eval :: Term -> M Int

So eval :: Term -> Int -> (Int, Int)

> answer, error :: Term

> I get the “ERROR” message when I type “eval answer” at the Hugs
> prompt.

eval answer :: M Int
eval answer :: Int -> (Int, Int)

Then you got to the error: there's no

instance Show (Int -> (Int, Int))

To call eval (x :: Term) you must pass a initial State, say 0.

eval answer 0 :: (Int, Int)

-- 
malebria
Marco Túlio Gontijo e Silva
Correio (MSN): malebria at riseup.net
Jabber (GTalk): malebria at jabber.org
Telefone: 33346720
Celular: 98116720
Endereço:
  Rua Paula Cândido, 257/201
  Gutierrez 30430-260
  Belo Horizonte/MG Brasil



More information about the Haskell-Cafe mailing list