[Haskell-cafe] nooby question on typing
Han Joosten
j.m.m.joosten at hccnet.nl
Sat Sep 13 09:49:31 EDT 2008
Hi,
I have a question about types in Haskell. I feel that I am overlooking some
obvious solution, but I do not manage to get it right. Here is the plot:
I have got 4 different types of 'rules', each with it's own constructor. So
i defined:
> type Rules = [Rule]
> data Rule = RuRule
> | SgRule
> | GcRule
> | FrRule
> deriving (Eq,Show)
> data RuRule
> = Ru { rrsrt :: Char
> , rrant :: Expression
> , rrfps :: FilePos
> } deriving (Eq,Show)
> data SgRule
> = Sg { srfps :: FilePos
> , srsig :: Rule
> , srxpl :: String
> , srtyp :: (Concept,Concept)
> } deriving (Eq,Show)
> data GcRule
> = Gc { grfps :: FilePos
> , grspe :: Morphism
> , grgen :: Expression
> } deriving (Eq,Show)
> data FrRule
> = Fr { fraut :: AutType
> , frdec :: Declaration
> , frcmp :: Expression
> , frpat :: String
> } deriving (Eq,Show)
Now I would like to be able to use these rules without knowing what kind
they are, in lists, however i get errors like
Couldn't match expected type `Rule' against inferred type `SgRule'.
Is there any other (even trivial?) way to get this done? I know Haskell well
enough to know that it is possible, but I don not know Haskell well enough
to know how to do it :teeth:
Any help is kindly appreciated!
Han Joosten
--
View this message in context: http://www.nabble.com/nooby-question-on-typing-tp19470727p19470727.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list