Skip to content

Commit 15736f7

Browse files
committed
Update for haskell-to-elm-0.2.0.0
1 parent 7e52260 commit 15736f7

File tree

5 files changed

+16
-24
lines changed

5 files changed

+16
-24
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased changes
44

5+
## 0.2.0.0
6+
7+
- Update code with changes from `haskell-to-elm-0.2.0.0`
8+
59
## 0.1.0.0
610

711
- Initial release

examples/UserAPI.hs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,19 @@ import Servant.To.Elm
2222
data User = User
2323
{ name :: Text
2424
, age :: Int
25-
} deriving
26-
( Generic
27-
, Aeson.ToJSON
28-
, SOP.Generic
29-
, SOP.HasDatatypeInfo
30-
, HasElmDecoder Aeson.Value
31-
, HasElmEncoder Aeson.Value
32-
, HasElmType
33-
)
34-
35-
instance HasElmDefinition User where
25+
} deriving (Generic, Aeson.ToJSON, SOP.Generic, SOP.HasDatatypeInfo)
26+
27+
instance HasElmType User where
3628
elmDefinition =
37-
deriveElmTypeDefinition @User defaultOptions "Api.User.User"
29+
Just $ deriveElmTypeDefinition @User defaultOptions "Api.User.User"
3830

39-
instance HasElmDecoderDefinition Aeson.Value User where
31+
instance HasElmDecoder Aeson.Value User where
4032
elmDecoderDefinition =
41-
deriveElmJSONDecoder @User defaultOptions Aeson.defaultOptions "Api.User.decoder"
33+
Just $ deriveElmJSONDecoder @User defaultOptions Aeson.defaultOptions "Api.User.decoder"
4234

43-
instance HasElmEncoderDefinition Aeson.Value User where
35+
instance HasElmEncoder Aeson.Value User where
4436
elmEncoderDefinition =
45-
deriveElmJSONEncoder @User defaultOptions Aeson.defaultOptions "Api.User.encoder"
37+
Just $ deriveElmJSONEncoder @User defaultOptions Aeson.defaultOptions "Api.User.encoder"
4638

4739
type UserAPI
4840
= "user" :> Get '[JSON] User

package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
- base >= 4.7 && < 5
2525
- bound >= 2.0.0
2626
- elm-syntax >= 0.1.0 && < 0.1.1
27-
- haskell-to-elm >= 0.1.0 && < 0.1.1
27+
- haskell-to-elm >= 0.2.0 && < 0.2.1
2828
- http-types >= 0.12.0
2929
- protolude >= 0.2.3
3030
- servant >= 0.16.0

src/Servant/To/Elm.hs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -600,13 +600,9 @@ instance HasElmEndpoints api => HasElmEndpoints (Servant.Description description
600600
-------------------------------------------------------------------------------
601601
-- Orphans
602602

603-
instance HasElmDefinition Servant.NoContent where
604-
elmDefinition =
605-
Definition.Type "NoContent.NoContent" [("NoContent", [])]
606-
607603
instance HasElmType Servant.NoContent where
608-
elmType =
609-
"NoContent.NoContent"
604+
elmDefinition =
605+
Just $ Definition.Type "NoContent.NoContent" [("NoContent", [])]
610606

611607
instance HasElmDecoder Aeson.Value Servant.NoContent where
612608
elmDecoder =

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ packages:
33
- .
44
extra-deps:
55
- elm-syntax-0.1.0.0
6-
- haskell-to-elm-0.1.0.0
6+
- haskell-to-elm-0.2.0.0

0 commit comments

Comments
 (0)