[Haskell-beginners] Example using gmapQ
Adrian May
adrian.alexander.may at gmail.com
Sat Jul 13 10:48:49 CEST 2013
Hi All,
I got this far:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
import Data.Text
import Data.Typeable
import Data.Data
data Thing = Thing { foo :: Int, bar :: String}
deriving (Read, Show, Typeable, Data)
thing :: Thing
thing = Thing 1 "wop"
con = toConstr thing
fields = constrFields con
main = putStrLn $ show con ++ show fields ++ ( Prelude.concat $ gmapQ show
thing )
But it's barfing like this:
Could not deduce (Show d) arising from a use of `show'
from the context (Data d)
bound by a type expected by the context: Data d => d -> [Char]
at w.hs:76:65-80
I can see why, but not how to fix it.
Any help much appreciated,
Adrian.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130713/74318a12/attachment.htm>
More information about the Beginners
mailing list