| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Clash.Normalize.Transformations.Cast
Synopsis
- argCastSpec :: Transformation
- argCastSpecWorker :: HasCallStack => TransformContext -> Term -> Term -> Term -> NormalizeSession Term
- caseCast :: Transformation
- caseCastWorker :: HasCallStack => TransformContext -> Term -> Term -> Type -> Type -> NormalizeSession Term
- elimCastCast :: Transformation
- elimCastCastWorker :: HasCallStack => TransformContext -> Term -> Term -> Type -> Type -> NormalizeSession Term
- letCast :: Transformation
- letCastWorker :: HasCallStack => TransformContext -> Term -> Term -> Type -> Type -> NormalizeSession Term
- splitCastWork :: Transformation
- splitCastWorkWorker :: HasCallStack => TransformContext -> Term -> Bind Term -> Term -> NormalizeSession Term
Documentation
argCastSpec :: Transformation Source #
Push cast over an argument to a function into that function
This is done by specializing on the casted argument.
Example:
y = f (cast a)
where f x = g x
transforms to:
y = f' a
where f' x' = (\x -> g x) (cast x')
The reason d'etre for this transformation is that we hope to end up with
and expression where two casts are "back-to-back" after which we can
eliminate them in elimCastCast.
argCastSpecWorker :: HasCallStack => TransformContext -> Term -> Term -> Term -> NormalizeSession Term Source #
The App handler of argCastSpec.
caseCast :: Transformation Source #
Push a cast over a case into it's alternatives.
caseCastWorker :: HasCallStack => TransformContext -> Term -> Term -> Type -> Type -> NormalizeSession Term Source #
elimCastCast :: Transformation Source #
Eliminate two back to back casts where the type going in and coming out are the same
(cast :: b -> a) $ (cast :: a -> b) x ==> x
elimCastCastWorker :: HasCallStack => TransformContext -> Term -> Term -> Type -> Type -> NormalizeSession Term Source #
The Cast handler of elimCastCast.
letCast :: Transformation Source #
Push a cast over a Let into it's body
letCastWorker :: HasCallStack => TransformContext -> Term -> Term -> Type -> Type -> NormalizeSession Term Source #
splitCastWork :: Transformation Source #
Make a cast work-free by splitting the work of to a separate binding
let x = cast (f a b)
==>
let x = cast x'
x' = f a b
splitCastWorkWorker :: HasCallStack => TransformContext -> Term -> Bind Term -> Term -> NormalizeSession Term Source #
The Let handler of splitCastWork.