Skip to content

Commit 03b9269

Browse files
committed
Enums don't need to shout
1 parent 20331e6 commit 03b9269

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

src/Web/HTML/HTMLMediaElement/ReadyState.purs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ import Data.Maybe (Maybe(..))
55
import Data.Enum (class Enum, class BoundedEnum, Cardinality(..), defaultSucc, defaultPred)
66

77
data ReadyState
8-
= HAVE_NOTHING
9-
| HAVE_METADATA
10-
| HAVE_CURRENT_DATA
11-
| HAVE_FUTURE_DATA
12-
| HAVE_ENOUGH_DATA
8+
= HaveNothing
9+
| HaveMetadata
10+
| HaveCurrentData
11+
| HaveFutureData
12+
| HaveEnoughData
1313

1414
derive instance eqReadyState :: Eq ReadyState
1515
derive instance ordReadyState :: Ord ReadyState
1616

1717
instance boundedReadyState :: Bounded ReadyState where
18-
bottom = HAVE_NOTHING
19-
top = HAVE_ENOUGH_DATA
18+
bottom = HaveNothing
19+
top = HaveEnoughData
2020

2121
instance enumReadyState :: Enum ReadyState where
2222
succ = defaultSucc toEnumReadyState fromEnumReadyState
@@ -28,27 +28,27 @@ instance boundedEnumReadyState :: BoundedEnum ReadyState where
2828
fromEnum = fromEnumReadyState
2929

3030
instance showReadyState :: Show ReadyState where
31-
show HAVE_NOTHING = "HAVE_NOTHING"
32-
show HAVE_METADATA = "HAVE_METADATA"
33-
show HAVE_CURRENT_DATA = "HAVE_CURRENT_DATA"
34-
show HAVE_FUTURE_DATA = "HAVE_FUTURE_DATA"
35-
show HAVE_ENOUGH_DATA = "HAVE_ENOUGH_DATA"
31+
show HaveNothing = "HaveNothing"
32+
show HaveMetadata = "HaveMetadata"
33+
show HaveCurrentData = "HaveCurrentData"
34+
show HaveFutureData = "HaveFutureData"
35+
show HaveEnoughData = "HaveEnoughData"
3636

3737
toEnumReadyState :: Int -> Maybe ReadyState
3838
toEnumReadyState =
3939
case _ of
40-
0 -> Just HAVE_NOTHING
41-
1 -> Just HAVE_METADATA
42-
2 -> Just HAVE_CURRENT_DATA
43-
3 -> Just HAVE_FUTURE_DATA
44-
4 -> Just HAVE_ENOUGH_DATA
40+
0 -> Just HaveNothing
41+
1 -> Just HaveMetadata
42+
2 -> Just HaveCurrentData
43+
3 -> Just HaveFutureData
44+
4 -> Just HaveEnoughData
4545
_ -> Nothing
4646

4747
fromEnumReadyState :: ReadyState -> Int
4848
fromEnumReadyState =
4949
case _ of
50-
HAVE_NOTHING -> 0
51-
HAVE_METADATA -> 1
52-
HAVE_CURRENT_DATA -> 2
53-
HAVE_FUTURE_DATA -> 3
54-
HAVE_ENOUGH_DATA -> 4
50+
HaveNothing -> 0
51+
HaveMetadata -> 1
52+
HaveCurrentData -> 2
53+
HaveFutureData -> 3
54+
HaveEnoughData -> 4

src/Web/HTML/HTMLTrackElement/ReadyState.purs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import Data.Maybe (Maybe(..))
55
import Data.Enum (class Enum, class BoundedEnum, Cardinality(..), defaultSucc, defaultPred)
66

77
data ReadyState
8-
= NONE
9-
| LOADING
10-
| LOADED
11-
| ERROR
8+
= None
9+
| Loading
10+
| Loaded
11+
| Error
1212

1313
derive instance eqReadyState :: Eq ReadyState
1414
derive instance ordReadyState :: Ord ReadyState
1515

1616
instance boundedReadyState :: Bounded ReadyState where
17-
bottom = NONE
18-
top = ERROR
17+
bottom = None
18+
top = Error
1919

2020
instance enumReadyState :: Enum ReadyState where
2121
succ = defaultSucc toEnumReadyState fromEnumReadyState
@@ -27,24 +27,24 @@ instance boundedEnumReadyState :: BoundedEnum ReadyState where
2727
fromEnum = fromEnumReadyState
2828

2929
instance showReadyState :: Show ReadyState where
30-
show NONE = "NONE"
31-
show LOADING = "LOADING"
32-
show LOADED = "LOADED"
33-
show ERROR = "ERROR"
30+
show None = "None"
31+
show Loading = "Loading"
32+
show Loaded = "Loaded"
33+
show Error = "Error"
3434

3535
toEnumReadyState :: Int -> Maybe ReadyState
3636
toEnumReadyState =
3737
case _ of
38-
0 -> Just NONE
39-
1 -> Just LOADING
40-
2 -> Just LOADED
41-
3 -> Just ERROR
38+
0 -> Just None
39+
1 -> Just Loading
40+
2 -> Just Loaded
41+
3 -> Just Error
4242
_ -> Nothing
4343

4444
fromEnumReadyState :: ReadyState -> Int
4545
fromEnumReadyState =
4646
case _ of
47-
NONE -> 0
48-
LOADING -> 1
49-
LOADED -> 2
50-
ERROR -> 3
47+
None -> 0
48+
Loading -> 1
49+
Loaded -> 2
50+
Error -> 3

0 commit comments

Comments
 (0)