never executed always true always false
1 module ElmVersion where
2
3 import Prelude ()
4 import Relude
5
6 import qualified Text.Show
7
8
9 data ElmVersion
10 = Elm_0_16 -- TODO: remove 0_16
11 | Elm_0_17 -- TODO: remove 0_17
12 | Elm_0_18
13 | Elm_0_19
14
15
16 instance Show ElmVersion where
17 show Elm_0_16 = "0.16"
18 show Elm_0_17 = "0.17"
19 show Elm_0_18 = "0.18"
20 show Elm_0_19 = "0.19"
21
22
23 parse :: String -> Either String ElmVersion
24 parse versionString =
25 case versionString of
26 "0.17" -> Right Elm_0_17
27 "0.18" -> Right Elm_0_18
28 "0.19" -> Right Elm_0_19
29 _ -> Left ("Invalid Elm version \"" ++ versionString ++ "\". Supported versions are 0.18, 0.19")
30
31
32 syntax_0_19_disallowApostropheInVars :: ElmVersion -> Bool
33 syntax_0_19_disallowApostropheInVars elmVersion =
34 case elmVersion of
35 Elm_0_16 -> False
36 Elm_0_17 -> False
37 Elm_0_18 -> False
38 Elm_0_19 -> True
39
40
41 style_0_19_stringEscape :: ElmVersion -> Bool
42 style_0_19_stringEscape elmVersion =
43 case elmVersion of
44 Elm_0_16 -> False
45 Elm_0_17 -> False
46 Elm_0_18 -> False
47 Elm_0_19 -> True
48
49
50 style_0_19_cannotExposeOpenListing :: ElmVersion -> Bool
51 style_0_19_cannotExposeOpenListing elmVersion =
52 case elmVersion of
53 Elm_0_16 -> False
54 Elm_0_17 -> False
55 Elm_0_18 -> False
56 Elm_0_19 -> True