Reputation: 3358
data Mine = Firstname String
| Lastname String
deriving (Show, Serialize)
This does not compile and gives the error
Not in scope: type constructor or class `Serialize'
Why is this not seen as member of the Serialize class although it is member of the Show class. I thought that all members of the Show class should serialize without problems?
Upvotes: 3
Views: 243
Reputation: 8136
If you do want to automatically derive Serialize for your class, you can do it like this:
{-# LANGUAGE DeriveGeneric #-}
import Data.Serialize (Serialize)
import GHC.Generics (Generic)
data Mine = Firstname String
| Lastname String
deriving (Show, Generic)
instance Serialize Mine
Upvotes: 3