<commit_before>module Data.CardSet exposing (CardSet(..), decoder, stringToCardSet, cardSetToString)

import Json.Decode exposing (string, andThen, Decoder)
import Json.Decode.Extra exposing (fromResult)


type CardSet
    = JL
    | GL
    | AT


decoder : Decoder CardSet
decoder =
    string |> andThen (fromString >> fromResult)


fromString : String -> Result String CardSet
fromString =
    Result.fromMaybe "Invalid card set." << stringToCardSet



-- Utils


stringToCardSet : String -> Maybe CardSet
stringToCardSet cardSet =
    case cardSet of
        "JL" ->
            Just JL

        "GL" ->
            Just GL

        "AT" ->
            Just AT

        _ ->
            Nothing


cardSetToString : CardSet -> String
cardSetToString cardSet =
    case cardSet of
        JL ->
            "Character"

        GL ->
            "Event"

        AT ->
            "Battle"<commit_msg>Fix CardSet strings<commit_after>module Data.CardSet exposing (CardSet(..), decoder, stringToCardSet, cardSetToString)

import Json.Decode exposing (string, andThen, Decoder)
import Json.Decode.Extra exposing (fromResult)


type CardSet
    = JL
    | GL
    | AT


decoder : Decoder CardSet
decoder =
    string |> andThen (fromString >> fromResult)


fromString : String -> Result String CardSet
fromString =
    Result.fromMaybe "Invalid card set." << stringToCardSet



-- Utils


stringToCardSet : String -> Maybe CardSet
stringToCardSet cardSet =
    case cardSet of
        "JL" ->
            Just JL

        "GL" ->
            Just GL

        "AT" ->
            Just AT

        _ ->
            Nothing


cardSetToString : CardSet -> String
cardSetToString cardSet =
    case cardSet of
        JL ->
            "JL"

        GL ->
            "GL"

        AT ->
            "AT"
{'fraction_non_alphanumeric': 0.0878754171301446, 'fraction_numerical': 0.0, 'mean_word_length': 1.9157212317666126, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2717470', 'n_tokens_mistral': 549, 'n_tokens_neox': 513, 'n_words': 151}