Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Short-hands for constructing compound expressions.
- module DDC.Type.Exp.Simple.Compounds
- xLAMs :: [Bind n] -> Exp a n -> Exp a n
- xLams :: [Bind n] -> Exp a n -> Exp a n
- makeXLamFlags :: [(Bool, Bind n)] -> Exp a n -> Exp a n
- takeXLAMs :: Exp a n -> Maybe ([Bind n], Exp a n)
- takeXLams :: Exp a n -> Maybe ([Bind n], Exp a n)
- takeXLamFlags :: Exp a n -> Maybe ([(Bool, Bind n)], Exp a n)
- xApps :: Exp a n -> [Exp a n] -> Exp a n
- takeXApps :: Exp a n -> Maybe (Exp a n, [Exp a n])
- takeXApps1 :: Exp a n -> Exp a n -> (Exp a n, [Exp a n])
- takeXAppsAsList :: Exp a n -> [Exp a n]
- takeXConApps :: Exp a n -> Maybe (DaCon n (Type n), [Exp a n])
- takeXPrimApps :: Exp a n -> Maybe (n, [Exp a n])
- xLets :: [Lets a n] -> Exp a n -> Exp a n
- splitXLets :: Exp a n -> ([Lets a n], Exp a n)
- bindsOfLets :: Lets a n -> ([Bind n], [Bind n])
- specBindsOfLets :: Lets a n -> [Bind n]
- valwitBindsOfLets :: Lets a n -> [Bind n]
- bindsOfPat :: Pat n -> [Bind n]
- takeCtorNameOfAlt :: Alt a n -> Maybe n
- wApp :: Witness a n -> Witness a n -> Witness a n
- wApps :: Witness a n -> [Witness a n] -> Witness a n
- takeXWitness :: Exp a n -> Maybe (Witness a n)
- takeWAppsAsList :: Witness a n -> [Witness a n]
- takePrimWiConApps :: Witness a n -> Maybe (n, [Witness a n])
- takeXType :: Exp a n -> Maybe (Type n)
- xUnit :: Exp a n
- dcUnit :: DaCon n t
- takeNameOfDaCon :: DaCon n t -> Maybe n
- takeTypeOfDaCon :: DaCon n (Type n) -> Maybe (Type n)
- kRate :: Type Name
- kProc :: Type Name
- isRateNatType :: Type Name -> Bool
- isSeriesType :: Type Name -> Bool
- isRateVecType :: Type Name -> Bool
- isRefType :: Type Name -> Bool
- isVectorType :: Type Name -> Bool
- isProcessType :: Type Name -> Bool
- tTuple1 :: Type Name -> Type Name
- tTuple2 :: Type Name -> Type Name -> Type Name
- tTupleN :: [Type Name] -> Type Name
- tVector :: Type Name -> Type Name
- tBuffer :: Type Name -> Type Name
- tSeries :: Type Name -> Type Name -> Type Name -> Type Name
- tRateVec :: Type Name -> Type Name -> Type Name
- tSegd :: Type Name -> Type Name -> Type Name
- tSel1 :: Type Name -> Type Name -> Type Name -> Type Name
- tSel2 :: Type Name -> Type Name -> Type Name -> Type Name -> Type Name
- tRef :: Type Name -> Type Name
- tWorld :: Type Name
- tRateNat :: Type Name -> Type Name
- tDown :: Int -> Type Name -> Type Name
- tTail :: Int -> Type Name -> Type Name
- tRateAppend :: Type Name -> Type Name -> Type Name
- tRateCross :: Type Name -> Type Name -> Type Name
- tProcess :: Type Name -> Type Name -> Type Name
- tResize :: Type Name -> Type Name -> Type Name -> Type Name
- tVoid :: Type Name
- tBool :: Type Name
- tNat :: Type Name
- tInt :: Type Name
- tWord :: Int -> Type Name
- tFloat :: Int -> Type Name
- tVec :: Int -> Type Name -> Type Name
- xBool :: Bool -> Exp a Name
- dcBool :: Bool -> DaCon Name (Type Name)
- xNat :: Integer -> Exp a Name
- dcNat :: Integer -> DaCon Name (Type Name)
- dcTuple1 :: DaCon Name (Type Name)
- xTuple2 :: Type Name -> Type Name -> Exp a Name -> Exp a Name -> Exp a Name
- dcTuple2 :: DaCon Name (Type Name)
- dcTupleN :: Int -> DaCon Name (Type Name)
- xvRep :: Int -> Type Name -> Exp () Name -> Exp () Name
- xvProj :: Int -> Int -> Type Name -> Exp () Name -> Exp () Name
- xvGather :: Int -> Type Name -> Type Name -> Exp () Name -> Exp () Name -> Exp () Name
- xvScatter :: Int -> Type Name -> Exp () Name -> Exp () Name -> Exp () Name -> Exp () Name
- xProj :: [Type Name] -> Int -> Exp () Name -> Exp () Name
- xRateOfSeries :: TypeF -> TypeF -> TypeF -> ExpF -> ExpF
- xNatOfRateNat :: TypeF -> ExpF -> ExpF
- xNext :: TypeF -> TypeF -> TypeF -> ExpF -> ExpF -> ExpF
- xNextC :: Int -> TypeF -> TypeF -> TypeF -> ExpF -> ExpF -> ExpF
- xDown :: Int -> TypeF -> TypeF -> TypeF -> ExpF -> ExpF -> ExpF
- xTail :: Int -> TypeF -> TypeF -> TypeF -> ExpF -> ExpF -> ExpF
- xSeriesOfRateVec :: Type Name -> Type Name -> Type Name -> Exp () Name -> Exp () Name
- xLoopN :: TypeF -> ExpF -> ExpF -> ExpF
- xGuard :: ExpF -> ExpF -> ExpF
- xSegment :: ExpF -> ExpF -> ExpF
- xSplit :: Int -> TypeF -> ExpF -> ExpF -> ExpF -> ExpF
- xNew :: Type Name -> Exp () Name -> Exp () Name
- xRead :: Type Name -> Exp () Name -> Exp () Name
- xWrite :: Type Name -> Exp () Name -> Exp () Name -> Exp () Name
- xNewVector :: Type Name -> Exp () Name -> Exp () Name
- xNewVectorR :: Type Name -> Type Name -> Exp () Name
- xNewVectorN :: Type Name -> Type Name -> Exp () Name -> Exp () Name
- xReadVector :: Type Name -> Exp () Name -> Exp () Name -> Exp () Name
- xReadVectorC :: Int -> Type Name -> Exp () Name -> Exp () Name -> Exp () Name
- xWriteVector :: Type Name -> Exp () Name -> Exp () Name -> Exp () Name -> Exp () Name
- xWriteVectorC :: Int -> Type Name -> Exp () Name -> Exp () Name -> Exp () Name -> Exp () Name
- xTailVector :: Int -> Type Name -> Type Name -> Exp () Name -> Exp () Name -> Exp () Name
- xTruncVector :: Type Name -> Exp () Name -> Exp () Name -> Exp () Name
Documentation
Lambdas
makeXLamFlags :: [(Bool, Bind n)] -> Exp a n -> Exp a n Source #
Make some nested lambda abstractions, using a flag to indicate whether the lambda is a level-1 (True), or level-0 (False) binder.
takeXLAMs :: Exp a n -> Maybe ([Bind n], Exp a n) Source #
Split type lambdas from the front of an expression,
or Nothing
if there aren't any.
takeXLams :: Exp a n -> Maybe ([Bind n], Exp a n) Source #
Split nested value or witness lambdas from the front of an expression,
or Nothing
if there aren't any.
takeXLamFlags :: Exp a n -> Maybe ([(Bool, Bind n)], Exp a n) Source #
Split nested lambdas from the front of an expression, with a flag indicating whether the lambda was a level-1 (True), or level-0 (False) binder.
Applications
takeXApps :: Exp a n -> Maybe (Exp a n, [Exp a n]) Source #
Flatten an application into the function part and its arguments.
Returns Nothing
if there is no outer application.
takeXApps1 :: Exp a n -> Exp a n -> (Exp a n, [Exp a n]) Source #
Flatten an application into the function part and its arguments.
This is like takeXApps
above, except we know there is at least one argument.
takeXAppsAsList :: Exp a n -> [Exp a n] Source #
Flatten an application into the function parts and arguments, if any.
takeXConApps :: Exp a n -> Maybe (DaCon n (Type n), [Exp a n]) Source #
Flatten an application of a data constructor into the constructor and its arguments.
Returns Nothing
if the expression isn't a constructor application.
takeXPrimApps :: Exp a n -> Maybe (n, [Exp a n]) Source #
Flatten an application of a primop into the variable and its arguments.
Returns Nothing
if the expression isn't a primop application.
Lets
splitXLets :: Exp a n -> ([Lets a n], Exp a n) Source #
Split let-bindings from the front of an expression, if any.
bindsOfLets :: Lets a n -> ([Bind n], [Bind n]) Source #
Take the binds of a Lets
.
The level-1 and level-0 binders are returned separately.
specBindsOfLets :: Lets a n -> [Bind n] Source #
Like bindsOfLets
but only take the spec (level-1) binders.
valwitBindsOfLets :: Lets a n -> [Bind n] Source #
Like bindsOfLets
but only take the value and witness (level-0) binders.
Patterns
Alternatives
takeCtorNameOfAlt :: Alt a n -> Maybe n Source #
Take the constructor name of an alternative, if there is one.
Witnesses
wApps :: Witness a n -> [Witness a n] -> Witness a n Source #
Construct a sequence of witness applications
takeXWitness :: Exp a n -> Maybe (Witness a n) Source #
Take the witness from an XWitness
argument, if any.
takeWAppsAsList :: Witness a n -> [Witness a n] Source #
Flatten an application into the function parts and arguments, if any.
takePrimWiConApps :: Witness a n -> Maybe (n, [Witness a n]) Source #
Flatten an application of a witness into the witness constructor name and its arguments.
Returns nothing if there is no witness constructor in head position.
Types
Data Constructors
takeNameOfDaCon :: DaCon n t -> Maybe n #
Take the name of data constructor, if there is one.
takeTypeOfDaCon :: DaCon n (Type n) -> Maybe (Type n) #
Take the type annotation of a data constructor, if we know it locally.
Fragment specific kinds
Fragment specific types
Primtiive types
Primitive literals and data constructors
xTuple2 :: Type Name -> Type Name -> Exp a Name -> Exp a Name -> Exp a Name Source #
Construct a Tuple2#
Primitive Vec operators
Series operators
xRateOfSeries :: TypeF -> TypeF -> TypeF -> ExpF -> ExpF Source #
xNatOfRateNat :: TypeF -> ExpF -> ExpF Source #