Advertisement
Guest User

Untitled

a guest
Mar 8th, 2022
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. newtype EventId =
  2.   EventId
  3.     { getEventId :: ByteString
  4.     }
  5.   deriving (Eq)
  6.  
  7. instance Show EventId where
  8.     showsPrec _ = shows . B16.encodeBase16 . getEventId
  9.  
  10. instance ToJSON EventId where
  11.     toJSON e = AesonTypes.String $ pack $ exportEventId e
  12.  
  13. instance FromJSON EventId where
  14.     parseJSON = withObject "EventId" $ \i -> do
  15.         i' <- i .: "id"
  16.        return $ fromJust $ eventId' i'
  17.  
  18. ####
  19.  
  20. • No instance for (FromJSON ByteString) arising from a use of ‘.:’
  21.    • In a stmt of a 'do' block: i' <- i .: "id"
  22.       In the expression:
  23.         do i' <- i .: "id"
  24.           return $ fromJust $ eventId' i'
  25.      In the second argument of ‘($)’, namely
  26.        ‘\ i
  27.           -> do i' <- i .: "id"
  28.                  return $ fromJust $ eventId' i'
  29.    |
  30. 52 |         i' <- i .: "id"
  31.   |               ^^^^^^^^^
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement