@@ -33,6 +33,7 @@ import Data.Tuple (Tuple, fst)
3333import Data.Foldable (lookup )
3434import Data.Tuple.Nested (Tuple3 , (/\))
3535
36+ newtype OptionFields :: forall k . k -> Type
3637newtype OptionFields a = OptionFields
3738 { optNames :: Array OptName
3839 , optCompleter :: Completer
@@ -49,10 +50,12 @@ newtype CommandFields a = CommandFields
4950 , cmdGroup :: Maybe String }
5051derive instance newtypeCommandFields :: Newtype (CommandFields a ) _
5152
53+ newtype ArgumentFields :: forall k . k -> Type
5254newtype ArgumentFields a = ArgumentFields
5355 { argCompleter :: Completer }
5456derive instance newtypeArgumentFields :: Newtype (ArgumentFields a ) _
5557
58+ class HasName :: forall k . (k -> Type ) -> Constraint
5659class HasName f where
5760 name :: forall a . OptName -> f a -> f a
5861
@@ -63,6 +66,7 @@ instance optionFieldsHasName :: HasName OptionFields where
6366instance flagFieldsHasName :: HasName FlagFields where
6467 name n = over FlagFields \fields -> fields{ flagNames = [n] <> fields.flagNames }
6568
69+ class HasCompleter :: forall k . (k -> Type ) -> Constraint
6670class HasCompleter f where
6771 modCompleter :: forall a . (Completer -> Completer ) -> f a -> f a
6872
@@ -72,6 +76,7 @@ instance optionFieldsHasCompleter :: HasCompleter OptionFields where
7276instance argumentFieldsHasCompleter :: HasCompleter ArgumentFields where
7377 modCompleter f = over ArgumentFields \p -> p{ argCompleter = f p.argCompleter }
7478
79+ class HasValue :: forall k . (k -> Type ) -> Constraint
7580class HasValue f where
7681 -- this is just so that it is not necessary to specify the kind of f
7782 hasValueDummy :: forall a . f a -> Unit
@@ -80,6 +85,7 @@ instance optionFieldsHasValue :: HasValue OptionFields where
8085instance argumentFieldsHasValue :: HasValue ArgumentFields where
8186 hasValueDummy _ = unit
8287
88+ class HasMetavar :: forall k . (k -> Type ) -> Constraint
8389class HasMetavar f where
8490 hasMetavarDummy :: forall a . f a -> Unit
8591instance optionFieldsHasMetavar :: HasMetavar OptionFields where
0 commit comments