-
-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Catamorphism and collapse tactics (#1865)
* Perform lookups of terms in scope and context * Cata and collapse * Remove unused import * Fix bug in intros wrt forall * Assume a value for cata recursion if necessary * Add tests * Fix imports * Add tests * Cleanup and haddock * Null case for letForEach * mkFunTys' * Simplify away single-use let bindings * Use the applicative instance to implement letForEach Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
13a2cc2
commit a7510a9
Showing
12 changed files
with
146 additions
and
6 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
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
14 changes: 14 additions & 0 deletions
14
plugins/hls-tactics-plugin/test/golden/MetaCataCollapse.expected.hs
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,14 @@ | ||
{-# LANGUAGE TypeOperators #-} | ||
|
||
import GHC.Generics | ||
|
||
class Yo f where | ||
yo :: f x -> Int | ||
|
||
instance (Yo f, Yo g) => Yo (f :*: g) where | ||
yo (fx :*: gx) | ||
= let | ||
fx_c = yo fx | ||
gx_c = yo gx | ||
in _ fx_c gx_c | ||
|
10 changes: 10 additions & 0 deletions
10
plugins/hls-tactics-plugin/test/golden/MetaCataCollapse.hs
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,10 @@ | ||
{-# LANGUAGE TypeOperators #-} | ||
|
||
import GHC.Generics | ||
|
||
class Yo f where | ||
yo :: f x -> Int | ||
|
||
instance (Yo f, Yo g) => Yo (f :*: g) where | ||
yo = [wingman| intros x, cata x, collapse |] | ||
|
8 changes: 8 additions & 0 deletions
8
plugins/hls-tactics-plugin/test/golden/MetaCataCollapseUnary.expected.hs
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,8 @@ | ||
import GHC.Generics | ||
|
||
class Yo f where | ||
yo :: f x -> Int | ||
|
||
instance (Yo f) => Yo (M1 _1 _2 f) where | ||
yo (M1 fx) = yo fx | ||
|
8 changes: 8 additions & 0 deletions
8
plugins/hls-tactics-plugin/test/golden/MetaCataCollapseUnary.hs
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,8 @@ | ||
import GHC.Generics | ||
|
||
class Yo f where | ||
yo :: f x -> Int | ||
|
||
instance (Yo f) => Yo (M1 _1 _2 f) where | ||
yo = [wingman| intros x, cata x, collapse |] | ||
|