Closed JustusAdam closed 6 years ago
Hm-m-m. When I added Param
I did not realise that it would make pass-through more complicated. With named-0.1
you could just do this:
foo :: Int `Named` "foo" -> ...
foo x = bar ! x
Now in named-0.2
there's this Param
wrapper so it no longer works... I need to think of a good solution, but for now I can suggest using an internal constructor as a temporary workaround:
import Named.Internal (Param(Param))
foo :: "x" :! Int -> ...
foo (Param -> x) = bar ! x
Okay, thanks. 😃
No problem! Reopen if the suggested solution doesn't work
It does. I chose to use a smart constructor though, to make it more future proof.
named :: name :! a -> Param (name :! a)
named = Param
foo :: "x" :! Int -> ...
foo (named -> x) = bar ! x
I find myself having a function which takes keyword arguments only to pass them onto another function that also takes the same named parameters like so
Would it be possible to add a view pattern (or pattern synonym) that transforms an
:!
to aParam
, lets call itretain
for now.