This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.2

Lunrelm.Json.Decoder

Decoder for Lunrelm Index. It decodes to a CodecIndexRecord.

decoder : Decoder CodecIndexRecord

CodecIndexRecord decoder.

Copyright (c) 2016 Robin Luiten

module Lunrelm.Json.Decoder (decoder) where

{-| Decoder for Lunrelm Index.

It decodes to a CodecIndexRecord.

@docs decoder

Copyright (c) 2016 Robin Luiten
-}

import Dict exposing (Dict)
import Json.Decode exposing (..)
import Set exposing (Set)
import Trie.Json.Decoder as TrieDecoder

import IndexModel exposing (..)
import Utils exposing ((|:))


{-| CodecIndexRecord decoder. -}
decoder : Decoder CodecIndexRecord
decoder =
    succeed CodecIndexRecord
      |: ("indexVersion" := string)
      |: ("indexType" := string)
      |: ("documentStore" := documentStoreDecoder)
      |: ("corpusTokens" := setDecoder)
      |: ("tokenStore" := TrieDecoder.decoder float)


documentStoreDecoder : Decoder (Dict String (Set String))
documentStoreDecoder =
    dict setDecoder


setDecoder : Decoder (Set String)
setDecoder =
    map Set.fromList (list string)