Grooming for the PermissionLevel module.

master
Philippe Pittoli 9 months ago
parent 9d3e139b52
commit 20b3a5aeb2

@ -1,10 +1,7 @@
-- | TODO: Phone module should include at least some sort of smart
-- | constructors, rejecting invalid phone numbers.
module App.PermissionLevel where
import Prelude
import Data.Codec.Argonaut (JsonCodec)
import Data.Codec.Argonaut as CA
import Data.Codec.Argonaut.Variant as CAV
import Data.Variant as V
@ -23,10 +20,10 @@ codec =
dimap toVariant fromVariant $ CAV.variantMatch { permission: Right CA.string }
where
toVariant = case _ of
None → V.inj (Proxy ∷ _ "permission") "none"
Read → V.inj (Proxy ∷ _ "permission") "read"
Edit → V.inj (Proxy ∷ _ "permission") "edit"
Admin → V.inj (Proxy ∷ _ "permission") "admin"
None V.inj (Proxy ∷ _ "permission") "none"
Read V.inj (Proxy ∷ _ "permission") "read"
Edit V.inj (Proxy ∷ _ "permission") "edit"
Admin → V.inj (Proxy ∷ _ "permission") "admin"
fromVariant = V.match
{ permission:

Loading…
Cancel
Save