Skip to content

Commit

Permalink
improve example
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbecich committed Oct 22, 2023
1 parent 0b5e11f commit bce383f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions example/src/MyLib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ foo = do
return $ Foo
(pack "Hello")
123
[10..20]
[10..13]
(Map.fromList [(pack "foo", 2), (pack "bar", 3), (pack "baz", 3)])
(Baz $ pack "hello")
testSum
Expand All @@ -49,7 +49,10 @@ fooServer = getFoo :<|> postFoo
where
getFoo = do
fooValue <- liftIO foo
liftIO $ putStrLn "Serving:"
liftIO $ putStrLn "-----------------"
liftIO $ putStrLn "Foo:"
liftIO $ putStrLn $ show fooValue
liftIO $ putStrLn "Serving JSON:"
liftIO $ Char8.putStrLn $ AP.encodePretty fooValue
return fooValue

Expand Down
4 changes: 2 additions & 2 deletions example/src/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Test.QuickCheck (Arbitrary (..), chooseEnum, oneof, resize,
data Baz = Baz
{ _bazMessage :: Text
}
deriving (FromJSON, Generic, ToJSON)
deriving (FromJSON, Generic, ToJSON, Show)

makeLenses ''Baz

Expand Down Expand Up @@ -66,7 +66,7 @@ data Foo = Foo
, _fooTestSum :: TestSum
, _fooTestData :: TestData
}
deriving (FromJSON, Generic, ToJSON)
deriving (FromJSON, Generic, ToJSON, Show)

makeLenses ''Foo

Expand Down

0 comments on commit bce383f

Please sign in to comment.