Skip to content

Instantly share code, notes, and snippets.

@rippinrobr
Created July 21, 2018 15:55
Show Gist options
  • Save rippinrobr/28988378bed88a8893017ba4bfc94702 to your computer and use it in GitHub Desktop.
Save rippinrobr/28988378bed88a8893017ba4bfc94702 to your computer and use it in GitHub Desktop.
The Conspiracy type alias and the conspiracyDecoder function in one gist
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