Creating Haskell instance declarations
Posted
by btl
on Stack Overflow
See other posts from Stack Overflow
or by btl
Published on 2010-04-21T21:37:59Z
Indexed on
2010/04/21
21:53 UTC
Read the original article
Hit count: 360
Hello, complete noob to Haskell here with probably an even noobier question. I'm trying to get ghci output working and am stuck on instance declarations. How could I declare an instance for "(Show (Stack -> Stack))" given:
data Cmd = LD Int
| ADD
| MULT
| DUP
deriving Show
type Prog = [Cmd]
type Stack = [Int]
type D = Stack -> Stack
I've been trying to create a declaration like:
instance Show D where show = Stack
but all my attempts have resulted in illegal instance declarations. Any help and/or references much appreciated!
© Stack Overflow or respective owner