0 | module Network.HTTP.Method
2 | import Generics.Derive
3 | import Derive.Prelude
5 | %hide Generics.Derive.Eq
6 | %hide Generics.Derive.Ord
7 | %hide Generics.Derive.Show
9 | %language ElabReflection
12 | data Method : Type where
21 | Custom : String -> Method
23 | %runElab derive "Method" [Generic, Meta, Eq, DecEq, Ord, Show]
26 | http_method_to_string : Method -> String
27 | http_method_to_string (Custom x) = toUpper x
28 | http_method_to_string x = show x
31 | string_to_http_method : String -> Method
32 | string_to_http_method x =
39 | "CONNECT" => CONNECT
40 | "OPTIONS" => OPTIONS
45 | FromString Method where
46 | fromString = string_to_http_method