From 20293795bd9a6f683194bf343a716c66dd5591b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hamal=20Dvo=C5=99=C3=A1k?= <mordae@anilinux.org> Date: Thu, 27 May 2021 12:43:34 +0200 Subject: [PATCH] Add (Param String) and expand (Param Bool) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Hamal Dvořák <mordae@anilinux.org> --- lib/Hikaru/Types.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Hikaru/Types.hs b/lib/Hikaru/Types.hs index 2952270..eff2e5e 100644 --- a/lib/Hikaru/Types.hs +++ b/lib/Hikaru/Types.hs @@ -155,6 +155,8 @@ where instance Param Bool where fromParam "true" = Just True fromParam "True" = Just True + fromParam "yes" = Just True + fromParam "Yes" = Just True fromParam "on" = Just True fromParam "On" = Just True fromParam "1" = Just True @@ -162,6 +164,8 @@ where fromParam "False" = Just False fromParam "off" = Just False fromParam "Off" = Just False + fromParam "no" = Just False + fromParam "No" = Just False fromParam "0" = Just False fromParam _else = Nothing {-# INLINE fromParam #-} @@ -179,6 +183,14 @@ where toParam char = pack [char] {-# INLINE toParam #-} + instance Param String where + fromParam "" = Nothing + fromParam sp = Just (cs sp) + {-# INLINE fromParam #-} + + toParam = cs + {-# INLINE toParam #-} + instance Param Text where fromParam "" = Nothing fromParam sp = Just sp -- GitLab