-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JuvixTree recursors and transformation framework (#2594)
* Generalizes JuvixCore map and fold recursors to work also for JuvixTree. * Adds a transformation framework to JuvixTree. * Adds identity trasformation tests for JuvixTree. * Depends on #2590 * Depends on #2589 * Depends on #2587
- Loading branch information
Showing
66 changed files
with
1,315 additions
and
685 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{-# LANGUAGE FunctionalDependencies #-} | ||
|
||
module Juvix.Compiler.Core.Data.TransformationId.Base where | ||
|
||
import Juvix.Prelude | ||
|
||
class TransformationId' t where | ||
transformationText :: t -> Text | ||
|
||
class (Enum p, Enum t, Bounded p, Bounded t, TransformationId' t) => PipelineId' t p | p -> t where | ||
pipelineText :: p -> Text | ||
pipeline :: p -> [t] | ||
|
||
data TransformationLikeId' t p | ||
= TransformationId t | ||
| PipelineId p | ||
deriving stock (Data) | ||
|
||
allTransformationLikeIds :: | ||
(Bounded t, Bounded p, Enum t, Enum p) => | ||
[TransformationLikeId' t p] | ||
allTransformationLikeIds = | ||
map TransformationId allElements | ||
++ map PipelineId allElements | ||
|
||
fromTransformationLike :: (PipelineId' t p) => TransformationLikeId' t p -> [t] | ||
fromTransformationLike = \case | ||
TransformationId i -> [i] | ||
PipelineId p -> pipeline p | ||
|
||
fromTransformationLikes :: (PipelineId' t p) => [TransformationLikeId' t p] -> [t] | ||
fromTransformationLikes = concatMap fromTransformationLike |
Oops, something went wrong.