Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module implements canonicalization pass that * eliminates identities * merges consecutive transformations like transform . transform into one * prevents invalid transformations like scaling by zero that would otherwise result in NaNs down the pipe * turns degenerate objects into empty space (i.e. circle 0, cube (pure 0))
Synopsis
- canonicalize2 :: SymbolicObj2 -> SymbolicObj2
- canonicalize3 :: SymbolicObj3 -> SymbolicObj3
- fmapObj2 :: (SymbolicObj2 -> SymbolicObj2) -> (SymbolicObj3 -> SymbolicObj3) -> (forall obj f a. Object obj f a => obj -> obj) -> SymbolicObj2 -> SymbolicObj2
- fmapObj3 :: (SymbolicObj3 -> SymbolicObj3) -> (SymbolicObj2 -> SymbolicObj2) -> (forall obj f a. Object obj f a => obj -> obj) -> SymbolicObj3 -> SymbolicObj3
- fmapSharedObj :: forall obj f a. Object obj f a => (obj -> obj) -> (obj -> obj) -> obj -> obj
- rewriteUntilIrreducible :: (Object obj f a, EqObj obj) => (obj -> obj) -> obj -> obj
- class EqObj a where
Documentation
canonicalize2 :: SymbolicObj2 -> SymbolicObj2 Source #
Canonicalize SymbolicObj2
tree
canonicalize3 :: SymbolicObj3 -> SymbolicObj3 Source #
Canonicalize SymbolicObj3
tree
:: (SymbolicObj2 -> SymbolicObj2) | SymbolicObj2 transformation |
-> (SymbolicObj3 -> SymbolicObj3) | SymbolicObj3 transformation |
-> (forall obj f a. Object obj f a => obj -> obj) | Shared2|3 transformation |
-> SymbolicObj2 | |
-> SymbolicObj2 |
Map over SymbolicObj2
and its underlying shared objects
This function is co-recursive with fmapSharedObj
to achieve
deep mapping over objects nested in Shared2
constructor
:: (SymbolicObj3 -> SymbolicObj3) | SymbolicObj3 transformation |
-> (SymbolicObj2 -> SymbolicObj2) | SymbolicObj2 transformation |
-> (forall obj f a. Object obj f a => obj -> obj) | Shared2|3 transformation |
-> SymbolicObj3 | |
-> SymbolicObj3 |
Map over SymbolicObj3
and its underlying shared objects
This function is co-recursive with fmapSharedObj
to achieve
deep mapping over objects nested in Shared3
constructor
fmapSharedObj :: forall obj f a. Object obj f a => (obj -> obj) -> (obj -> obj) -> obj -> obj Source #
Map over SharedObj
and its underlying objects
This resembles bimap from Bifunctor but the structure of SharedObj doesn't allow us to define Bifunctor instance as we need to map over the first type argument (obj) and not f and a.
rewriteUntilIrreducible Source #
Rewrite the object tree until it cannot be reduced further
We have to define our own variant of Eq which compares objects when possible and returns True when we cannot compare things like functions
Instances
EqObj ExtrudeMScale Source # | |
Defined in Graphics.Implicit.Canon (=^=) :: ExtrudeMScale -> ExtrudeMScale -> Bool Source # | |
EqObj SymbolicObj2 Source # | |
Defined in Graphics.Implicit.Canon (=^=) :: SymbolicObj2 -> SymbolicObj2 -> Bool Source # | |
EqObj SymbolicObj3 Source # | |
Defined in Graphics.Implicit.Canon (=^=) :: SymbolicObj3 -> SymbolicObj3 -> Bool Source # | |
EqObj a => EqObj [a] Source # | |
Defined in Graphics.Implicit.Canon | |
(EqObj obj, Eq (f a)) => EqObj (SharedObj obj f a) Source # | |