I am using GHC 7.10.2. There is a class type RenderRoutein yesodwhich is as follows:
class Eq (Route a) => RenderRoute a where
data Route a
renderRoute :: Route a -> ([Text], [(Text, Text)])
I wrote an instance in a module with a name Yesod.Crudthat looks like this:
data Crud master p c = Crud { ... }
instance (PathPiece (Key c), Eq (Key c), PathPiece p, Eq p) => RenderRoute (Crud master p c) where
data Route (Crud master p c)
= EditR (Key c)
| DeleteR (Key c)
| IndexR p
| AddR p
| ViewR (Key c)
If somewhere else I import everything using this
import Yesod.Crud
then five data constructors belonging to my associated data type are in scope. I am trying to figure out how to write an import statement in a more restrictive way. Say that I only want to add ViewRto the scope (and probably the data type Crud). If i try
import Yesod.Crud (ViewR)
Then the GHC errors with the following:
src/Import/Base.hs:9:55:
In module ‘Yesod.Crud’:
‘ViewR’ is a data constructor of ‘Route’
To import it use
‘import’ Yesod.Crud( Route( ViewR ) )
or
‘import’ Yesod.Crud( Route(..) )
If I try the first sentence, these are errors with
src/Import/Base.hs:10:46:
Module ‘Yesod.Crud’ does not export ‘Route(ViewR)’
. GHC , . , , - , . , , .