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

Even

Because the constructor for Even is not exported, you can be confident that if you are using a Even, then its Even.

type Even = Even Int
fromInt : Int -> Maybe Even
toInt : Even -> Int
module Even exposing (Even, fromInt, toInt)

{-|
Because the constructor for `Even` is not exported, you can be
confident that if you are using a `Even`, then its `Even`.

@docs Even, fromInt, toInt
-}


{-| -}
type Even
    = Even Int


{-| -}
fromInt : Int -> Maybe Even
fromInt x =
    if x % 2 == 0 then
        Just (Even x)
    else
        Nothing


{-| -}
toInt : Even -> Int
toInt (Even x) =
    x