All pastes #989702 Raw Edit

Something

public text v1 · immutable
#989702 ·published 2008-04-19 16:50 UTC
rendered paste body
data Action a =
    Login UserID
    | Logout
    | StartGame Game UserID
    | GameAction a
    | GameOver Status
    | Error Status

main1 = toString (Login "asd")



class Serializable a where
    toString ::  a -> String
    fromString  :: String -> a

instance Serializable a => Serializable (Action a) where
    toString (Login user) = "Login,(" ++ user ++ ")"
    etc....



Actions.hs:20:8:
    Ambiguous type variable `a' in the constraint:
      `Serializable a'
        arising from a use of `toString' at Actions.hs:20:8-29
    Probable fix: add a type signature that fixes these type variable(s)
Failed, modules loaded: none.