Created
July 21, 2018 15:55
-
-
Save rippinrobr/28988378bed88a8893017ba4bfc94702 to your computer and use it in GitHub Desktop.
The Conspiracy type alias and the conspiracyDecoder function in one gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type alias Conspiracy = { | |
title : String | |
,page_id : String | |
,summary : String | |
,content : String | |
,background: String | |
} | |
-- conspiracyDecoder is the code that pulls the data out of the JSON object | |
-- and creates a Conspiracy object | |
conspiracyDecoder : Decoder Conspiracy | |
conspiracyDecoder = | |
map5 Conspiracy | |
(field "title" string) | |
(field "page_id" string) | |
(field "summary" string) | |
(field "content" string) | |
(field "background" string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment