aboutsummaryrefslogtreecommitdiff
path: root/src/Base.elm
blob: e619939c58e53373155bf5b50e8cae09fad91097 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{-
   - This file is part of `typers`.
   -
   - `typers` is free software: you can redistribute it and/or modify
   - it under the terms of the GNU Affero Public License as published by
   - the Free Software Foundation, either version 3 of the License, or
   - (at your option) any later version.
   -
   - `typers` is distributed in the hope that it will be useful,
   - but WITHOUT ANY WARRANTY; without even the implied warranty of
   - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   - GNU Affero Public License for more details.
   -
   - You should have received a copy of the GNU Affero Public License
   - along with `typers`.  If not, see <https://www.gnu.org/licenses/>.
-}


module Base exposing (..)

import Array exposing (Array)
import Time exposing (Posix)


type WordStatus
    = Correct
    | Wrong
    | Todo
    | CurrentWord


type alias Word =
    { content : String
    , status : WordStatus
    }


type alias Model =
    { begin : Maybe Posix
    , end : Maybe Posix
    , words : Array Word
    , accuracy : Maybe Float
    , config : Config
    , currentWord : Int
    , inputBox : String
    , inputCorrect : Bool
    }


type alias Config =
    { punctuation : Bool
    , capitals : Bool
    , length : Int
    }


type Msg
    = Started Time.Posix
    | Finished Time.Posix
    | CorrectInput
    | CorrectSoFar
    | NextWord
    | WrongInput
    | InputChanged String
    | LoadWords (List String)
    | WordLengthChanged Int
    | Redo