License | BSD-3-Clause |
---|---|
Maintainer | Jamie Willis |
Stability | stable |
Safe Haskell | None |
Language | Haskell2010 |
This module exports the Defunc
type and associated patterns. These are by no means required
to use Parsley, however they can serve as useful shortcuts to their regular Haskell equivalents.
As they are in datatype form, they are inspectable by the internal Parsley machinery, which may
improve optimisation opportunities or code generation.
Since: 0.1.0.0
Synopsis
- data Defunc a where
- ID :: forall a1. Defunc (a1 -> a1)
- COMPOSE :: forall b c a1. Defunc ((b -> c) -> (a1 -> b) -> a1 -> c)
- FLIP :: forall a1 b c. Defunc ((a1 -> b -> c) -> b -> a1 -> c)
- APP_H :: forall a1 a. Defunc (a1 -> a) -> Defunc a1 -> Defunc a
- EQ_H :: forall a1. Eq a1 => Defunc a1 -> Defunc (a1 -> Bool)
- LIFTED :: forall a. (Show a, Lift a) => a -> Defunc a
- CONS :: forall a1. Defunc (a1 -> [a1] -> [a1])
- CONST :: forall a1 b. Defunc (a1 -> b -> a1)
- EMPTY :: forall a1. Defunc [a1]
- BLACK :: forall a. WQ a -> Defunc a
- IF_S :: forall a. Defunc Bool -> Defunc a -> Defunc a -> Defunc a
- LAM_S :: forall a1 b. (Defunc a1 -> Defunc b) -> Defunc (a1 -> b)
- LET_S :: forall a1 a. Defunc a1 -> (Defunc a1 -> Defunc a) -> Defunc a
- pattern UNIT :: Defunc ()
- pattern FLIP_CONST :: forall x a b. () => forall. x ~ (a -> b -> b) => Defunc x
- pattern FLIP_H :: forall y x a b c. () => forall. (x -> y) ~ ((a -> b -> c) -> b -> a -> c) => Defunc x -> Defunc y
- pattern COMPOSE_H :: forall z x y b c a. () => forall. (x -> y -> z) ~ ((b -> c) -> (a -> b) -> a -> c) => Defunc x -> Defunc y -> Defunc z
Documentation
This datatype is useful for providing an inspectable representation of common Haskell functions.
These can be provided in place of WQ
to any combinator that requires it. The only difference is
that the Parsley compiler is able to manipulate and match on the constructors, which might lead to
optimisations. They can also be more convenient than constructing the WQ
object itself:
ID ~= WQ id [||id||] APP_H f x ~= WQ (f x) [||f x||]
Since: parsley-core-0.1.0.0
ID :: forall a1. Defunc (a1 -> a1) | Corresponds to the standard |
COMPOSE :: forall b c a1. Defunc ((b -> c) -> (a1 -> b) -> a1 -> c) | Corresponds to the standard |
FLIP :: forall a1 b c. Defunc ((a1 -> b -> c) -> b -> a1 -> c) | Corresponds to the standard |
APP_H :: forall a1 a. Defunc (a1 -> a) -> Defunc a1 -> Defunc a | Corresponds to function application of two other |
EQ_H :: forall a1. Eq a1 => Defunc a1 -> Defunc (a1 -> Bool) | Corresponds to the partially applied |
LIFTED :: forall a. (Show a, Lift a) => a -> Defunc a | Represents a liftable, showable value |
CONS :: forall a1. Defunc (a1 -> [a1] -> [a1]) | Represents the standard |
CONST :: forall a1 b. Defunc (a1 -> b -> a1) | Represents the standard |
EMPTY :: forall a1. Defunc [a1] | Represents the empty list |
BLACK :: forall a. WQ a -> Defunc a | Wraps up any value of type |
IF_S :: forall a. Defunc Bool -> Defunc a -> Defunc a -> Defunc a | Represents the regular Haskell Since: parsley-core-0.1.1.0 |
LAM_S :: forall a1 b. (Defunc a1 -> Defunc b) -> Defunc (a1 -> b) | Represents a Haskell lambda abstraction Since: parsley-core-0.1.1.0 |
LET_S :: forall a1 a. Defunc a1 -> (Defunc a1 -> Defunc a) -> Defunc a | Represents a Haskell let binding Since: parsley-core-0.1.1.0 |
Instances
Quapplicative Defunc | This instance is used to manipulate values of Since: parsley-core-0.1.0.0 |
Show (Defunc a) | |
pattern FLIP_CONST :: forall x a b. () => forall. x ~ (a -> b -> b) => Defunc x #
Represents the flipped standard const
function applied to no arguments
Since: parsley-core-0.1.0.0