Skip to content

Commit

Permalink
Merge pull request #3 from knuton/remove-json-support
Browse files Browse the repository at this point in the history
Remove JSON encoding and decoding functionality
  • Loading branch information
knuton authored Oct 10, 2019
2 parents 0228e70 + a1bf943 commit 5e85462
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
1 change: 0 additions & 1 deletion elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"elm-version": "0.19.0 <= v < 0.20.0",
"dependencies": {
"elm/core": "1.0.0 <= v < 2.0.0",
"elm/json": "1.1.3 <= v < 2.0.0",
"elm/parser": "1.1.0 <= v < 2.0.0"
},
"test-dependencies": {
Expand Down
25 changes: 2 additions & 23 deletions src/Semver.elm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Semver exposing
( Version, version, isValid
, compare, lessThan, greaterThan
, print, parse, decode, encode
, print, parse
)

{-| Provides basic functionality for handling semantic version numbers. Follows
Expand All @@ -24,13 +24,11 @@ For the definition of semantic versioning with Semver 2.0.0, see
# Handling Version Strings
@docs print, parse, decode, encode
@docs print, parse
-}

import Char
import Json.Decode as JD exposing (Decoder)
import Json.Encode as JE
import Parser exposing ((|.), (|=), Parser)


Expand Down Expand Up @@ -193,25 +191,6 @@ parse versionString =
|> Result.toMaybe


{-| Decode a version from a JSON value.
-}
decode : Decoder Version
decode =
let
maybeToDecoder =
Maybe.map JD.succeed
>> Maybe.withDefault (JD.fail "Invalid version string.")
in
JD.string |> JD.andThen (parse >> maybeToDecoder)


{-| Encode a version as JSON.
-}
encode : Version -> JE.Value
encode =
print >> JE.string


parser : Parser Version
parser =
Parser.succeed Version
Expand Down

0 comments on commit 5e85462

Please sign in to comment.