add pisDJust util function
the counterpart of `pisJust`, for type `PMaybeData`
This commit is contained in:
parent
f30ca26ea5
commit
de517fc144
1 changed files with 12 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ module Agora.Utils (
|
||||||
pkeysEqual,
|
pkeysEqual,
|
||||||
pnub,
|
pnub,
|
||||||
pisUniq,
|
pisUniq,
|
||||||
|
pisDJust,
|
||||||
|
|
||||||
-- * Functions which should (probably) not be upstreamed
|
-- * Functions which should (probably) not be upstreamed
|
||||||
anyOutput,
|
anyOutput,
|
||||||
|
|
@ -358,6 +359,17 @@ pisUniq =
|
||||||
)
|
)
|
||||||
(const $ pcon PTrue)
|
(const $ pcon PTrue)
|
||||||
|
|
||||||
|
-- | Yield True if a given PMaybeData is of form PDJust _.
|
||||||
|
pisDJust :: Term s (PMaybeData a :--> PBool)
|
||||||
|
pisDJust = phoistAcyclic $
|
||||||
|
plam $ \x ->
|
||||||
|
pmatch
|
||||||
|
x
|
||||||
|
( \case
|
||||||
|
PDJust _ -> pconstant True
|
||||||
|
_ -> pconstant False
|
||||||
|
)
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
{- Functions which should (probably) not be upstreamed
|
{- Functions which should (probably) not be upstreamed
|
||||||
All of these functions are quite inefficient.
|
All of these functions are quite inefficient.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue