Add part2, clean up part1 some
This commit is contained in:
29
advanced/part2/src/CommentId.elm
Normal file
29
advanced/part2/src/CommentId.elm
Normal file
@@ -0,0 +1,29 @@
|
||||
module CommentId exposing (CommentId, decoder, toString)
|
||||
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
|
||||
|
||||
|
||||
-- TYPES
|
||||
|
||||
|
||||
type CommentId
|
||||
= CommentId Int
|
||||
|
||||
|
||||
|
||||
-- CREATE
|
||||
|
||||
|
||||
decoder : Decoder CommentId
|
||||
decoder =
|
||||
Decode.map CommentId Decode.int
|
||||
|
||||
|
||||
|
||||
-- TRANSFORM
|
||||
|
||||
|
||||
toString : CommentId -> String
|
||||
toString (CommentId id) =
|
||||
String.fromInt id
|
||||
Reference in New Issue
Block a user