module Web.HTML.HTMLDocument.ReadyState where

import HPrelude

data ReadyState
  = Loading
  | Interactive
  | Complete
  deriving (ReadyState -> ReadyState -> Bool
(ReadyState -> ReadyState -> Bool)
-> (ReadyState -> ReadyState -> Bool) -> Eq ReadyState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReadyState -> ReadyState -> Bool
== :: ReadyState -> ReadyState -> Bool
$c/= :: ReadyState -> ReadyState -> Bool
/= :: ReadyState -> ReadyState -> Bool
Eq, Eq ReadyState
Eq ReadyState =>
(ReadyState -> ReadyState -> Ordering)
-> (ReadyState -> ReadyState -> Bool)
-> (ReadyState -> ReadyState -> Bool)
-> (ReadyState -> ReadyState -> Bool)
-> (ReadyState -> ReadyState -> Bool)
-> (ReadyState -> ReadyState -> ReadyState)
-> (ReadyState -> ReadyState -> ReadyState)
-> Ord ReadyState
ReadyState -> ReadyState -> Bool
ReadyState -> ReadyState -> Ordering
ReadyState -> ReadyState -> ReadyState
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ReadyState -> ReadyState -> Ordering
compare :: ReadyState -> ReadyState -> Ordering
$c< :: ReadyState -> ReadyState -> Bool
< :: ReadyState -> ReadyState -> Bool
$c<= :: ReadyState -> ReadyState -> Bool
<= :: ReadyState -> ReadyState -> Bool
$c> :: ReadyState -> ReadyState -> Bool
> :: ReadyState -> ReadyState -> Bool
$c>= :: ReadyState -> ReadyState -> Bool
>= :: ReadyState -> ReadyState -> Bool
$cmax :: ReadyState -> ReadyState -> ReadyState
max :: ReadyState -> ReadyState -> ReadyState
$cmin :: ReadyState -> ReadyState -> ReadyState
min :: ReadyState -> ReadyState -> ReadyState
Ord, Int -> ReadyState -> ShowS
[ReadyState] -> ShowS
ReadyState -> String
(Int -> ReadyState -> ShowS)
-> (ReadyState -> String)
-> ([ReadyState] -> ShowS)
-> Show ReadyState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReadyState -> ShowS
showsPrec :: Int -> ReadyState -> ShowS
$cshow :: ReadyState -> String
show :: ReadyState -> String
$cshowList :: [ReadyState] -> ShowS
showList :: [ReadyState] -> ShowS
Show)

print :: ReadyState -> Text
print :: ReadyState -> Text
print = \case
  ReadyState
Loading -> Text
"loading"
  ReadyState
Interactive -> Text
"interactive"
  ReadyState
Complete -> Text
"complete"

parse :: Text -> Maybe ReadyState
parse :: Text -> Maybe ReadyState
parse = \case
  Text
"loading" -> ReadyState -> Maybe ReadyState
forall a. a -> Maybe a
Just ReadyState
Loading
  Text
"interactive" -> ReadyState -> Maybe ReadyState
forall a. a -> Maybe a
Just ReadyState
Interactive
  Text
"complete" -> ReadyState -> Maybe ReadyState
forall a. a -> Maybe a
Just ReadyState
Complete
  Text
_ -> Maybe ReadyState
forall a. Maybe a
Nothing