Fixes weird segmentation fault on message receive.

By removing the strictness annotation from an existential field.
This commit is contained in:
Abhinav Sarkar 2015-06-22 15:21:18 +05:30
parent 5f7983e1f8
commit 4410ab2f8c

View File

@ -43,13 +43,13 @@ data Message = Message
-- | The typeclass for different types of messages.
class (Typeable msg, Show msg, Eq msg, Ord msg) => MessageC msg where
toMessage :: msg -> MessageW
toMessage = MessageW
toMessage !msg = MessageW msg
fromMessage :: MessageW -> Maybe msg
fromMessage (MessageW msg) = cast msg
-- | A wrapper over all types of messages.
data MessageW = forall m . MessageC m => MessageW !m deriving (Typeable)
data MessageW = forall m . MessageC m => MessageW m deriving (Typeable)
instance Show MessageW where
show (MessageW m) = show m