0 | module Network.HTTP.Protocol
3 | import Generics.Derive
4 | import Derive.Prelude
6 | %hide Generics.Derive.Eq
7 | %hide Generics.Derive.Ord
8 | %hide Generics.Derive.Show
10 | %language ElabReflection
13 | data Protocol : Type where
17 | %runElab derive "Protocol" [Generic, Meta, Eq, DecEq, Show]
20 | protocol_port_number : Protocol -> Bits16
21 | protocol_port_number HTTP = 80
22 | protocol_port_number HTTPS = 443
25 | protocol_from_str : String -> Maybe Protocol
26 | protocol_from_str protocol =
27 | case toUpper protocol of
29 | "HTTPS" => Just HTTPS