Using elm-format for all files

This commit is contained in:
Eike Kettner
2019-12-29 21:55:12 +01:00
parent 546f1a6ee3
commit 2001cca88b
84 changed files with 7668 additions and 5079 deletions

View File

@ -1,4 +1,10 @@
module Data.ContactType exposing (..)
module Data.ContactType exposing
( ContactType(..)
, all
, fromString
, toString
)
type ContactType
= Phone
@ -9,28 +15,54 @@ type ContactType
| Website
fromString: String -> Maybe ContactType
fromString : String -> Maybe ContactType
fromString str =
case String.toLower str of
"phone" -> Just Phone
"mobile" -> Just Mobile
"fax" -> Just Fax
"email" -> Just Email
"docspell" -> Just Docspell
"website" -> Just Website
_ -> Nothing
"phone" ->
Just Phone
toString: ContactType -> String
"mobile" ->
Just Mobile
"fax" ->
Just Fax
"email" ->
Just Email
"docspell" ->
Just Docspell
"website" ->
Just Website
_ ->
Nothing
toString : ContactType -> String
toString ct =
case ct of
Phone -> "Phone"
Mobile -> "Mobile"
Fax -> "Fax"
Email -> "Email"
Docspell -> "Docspell"
Website -> "Website"
Phone ->
"Phone"
all: List ContactType
Mobile ->
"Mobile"
Fax ->
"Fax"
Email ->
"Email"
Docspell ->
"Docspell"
Website ->
"Website"
all : List ContactType
all =
[ Mobile
, Phone

View File

@ -1,45 +1,72 @@
module Data.Direction exposing (..)
module Data.Direction exposing
( Direction(..)
, all
, fromString
, icon
, iconFromMaybe
, iconFromString
, toString
)
type Direction
= Incoming
| Outgoing
fromString: String -> Maybe Direction
fromString : String -> Maybe Direction
fromString str =
case String.toLower str of
"outgoing" -> Just Outgoing
"incoming" -> Just Incoming
_ -> Nothing
"outgoing" ->
Just Outgoing
all: List Direction
"incoming" ->
Just Incoming
_ ->
Nothing
all : List Direction
all =
[ Incoming
, Outgoing
]
toString: Direction -> String
toString : Direction -> String
toString dir =
case dir of
Incoming -> "Incoming"
Outgoing -> "Outgoing"
Incoming ->
"Incoming"
icon: Direction -> String
Outgoing ->
"Outgoing"
icon : Direction -> String
icon dir =
case dir of
Incoming -> "level down alternate icon"
Outgoing -> "level up alternate icon"
Incoming ->
"level down alternate icon"
unknownIcon: String
Outgoing ->
"level up alternate icon"
unknownIcon : String
unknownIcon =
"question circle outline icon"
iconFromString: String -> String
iconFromString : String -> String
iconFromString dir =
fromString dir
|> Maybe.map icon
|> Maybe.withDefault unknownIcon
iconFromMaybe: Maybe String -> String
iconFromMaybe : Maybe String -> String
iconFromMaybe ms =
Maybe.map iconFromString ms
|> Maybe.withDefault unknownIcon

View File

@ -1,28 +1,39 @@
module Data.Flags exposing (..)
module Data.Flags exposing
( Config
, Flags
, getToken
, withAccount
, withoutAccount
)
import Api.Model.AuthResult exposing (AuthResult)
type alias Config =
{ appName: String
, baseUrl: String
, signupMode: String
, docspellAssetPath: String
{ appName : String
, baseUrl : String
, signupMode : String
, docspellAssetPath : String
}
type alias Flags =
{ account: Maybe AuthResult
, config: Config
{ account : Maybe AuthResult
, config : Config
}
getToken: Flags -> Maybe String
getToken : Flags -> Maybe String
getToken flags =
flags.account
|> Maybe.andThen (\a -> a.token)
withAccount: Flags -> AuthResult -> Flags
withAccount : Flags -> AuthResult -> Flags
withAccount flags acc =
{ flags | account = Just acc }
withoutAccount: Flags -> Flags
withoutAccount : Flags -> Flags
withoutAccount flags =
{ flags | account = Nothing }

View File

@ -1,27 +1,49 @@
module Data.Language exposing (..)
module Data.Language exposing
( Language(..)
, all
, fromString
, toIso3
, toName
)
type Language
= German
| English
fromString: String -> Maybe Language
fromString str =
if str == "deu" || str == "de" || str == "german" then Just German
else if str == "eng" || str == "en" || str == "english" then Just English
else Nothing
toIso3: Language -> String
fromString : String -> Maybe Language
fromString str =
if str == "deu" || str == "de" || str == "german" then
Just German
else if str == "eng" || str == "en" || str == "english" then
Just English
else
Nothing
toIso3 : Language -> String
toIso3 lang =
case lang of
German -> "deu"
English -> "eng"
German ->
"deu"
toName: Language -> String
English ->
"eng"
toName : Language -> String
toName lang =
case lang of
German -> "German"
English -> "English"
German ->
"German"
all: List Language
English ->
"English"
all : List Language
all =
[ German, English ]

View File

@ -1,25 +1,43 @@
module Data.Priority exposing (..)
module Data.Priority exposing
( Priority(..)
, all
, fromString
, toName
)
type Priority
= High
| Low
fromString: String -> Maybe Priority
fromString : String -> Maybe Priority
fromString str =
let
s = String.toLower str
s =
String.toLower str
in
case s of
"low" -> Just Low
"high" -> Just High
_ -> Nothing
case s of
"low" ->
Just Low
toName: Priority -> String
"high" ->
Just High
_ ->
Nothing
toName : Priority -> String
toName lang =
case lang of
Low -> "Low"
High-> "High"
Low ->
"Low"
all: List Priority
High ->
"High"
all : List Priority
all =
[ Low, High ]

View File

@ -1,24 +1,41 @@
module Data.SourceState exposing (..)
module Data.SourceState exposing
( SourceState(..)
, all
, fromString
, toString
)
type SourceState
= Active
| Disabled
fromString: String -> Maybe SourceState
fromString : String -> Maybe SourceState
fromString str =
case String.toLower str of
"active" -> Just Active
"disabled" -> Just Disabled
_ -> Nothing
"active" ->
Just Active
all: List SourceState
"disabled" ->
Just Disabled
_ ->
Nothing
all : List SourceState
all =
[ Active
, Disabled
]
toString: SourceState -> String
toString : SourceState -> String
toString dir =
case dir of
Active -> "Active"
Disabled -> "Disabled"
Active ->
"Active"
Disabled ->
"Disabled"

View File

@ -1,24 +1,41 @@
module Data.UserState exposing (..)
module Data.UserState exposing
( UserState(..)
, all
, fromString
, toString
)
type UserState
= Active
| Disabled
fromString: String -> Maybe UserState
fromString : String -> Maybe UserState
fromString str =
case String.toLower str of
"active" -> Just Active
"disabled" -> Just Disabled
_ -> Nothing
"active" ->
Just Active
all: List UserState
"disabled" ->
Just Disabled
_ ->
Nothing
all : List UserState
all =
[ Active
, Disabled
]
toString: UserState -> String
toString : UserState -> String
toString dir =
case dir of
Active -> "Active"
Disabled -> "Disabled"
Active ->
"Active"
Disabled ->
"Disabled"