| Issue 209: | cannot derive Data instance for ModuleName | |
| 1 person starred this issue and may be notified of changes. | Back to list |
when compiling
{-# LANGUAGE TemplateHaskell #-}
import Data.Data
import Data.DeriveTH
import Distribution.ModuleName
$(derive makeData ''ModuleName)
I get
Not in scope: data constructor `ModuleName'
This is reproducible with derive 2.0 as it is with derive 0.1.4
|
|
,
Aug 05, 2009
You can't do this because ModuleName is exported abstractly, so the generated definition can't be spliced in as it refers to the hidden constructor name. One option would be to define gfoldl k r x = r x, so you can't use SYB to operate inside ModuleName, but you can construct values containing ModuleName and still derive Data on them. Would that meet your needs?
Labels: Proj-Derive
|
|
,
Aug 06, 2009
With the darcs version of derive you can do: $(derive makeDataAbstract ''ModuleName) That should work - if it doesn't let me know.
Status: Fixed
|
|
|
|