├── .gitignore
├── LICENSE
├── Makefile
├── README.md
├── Setup.hs
├── app
└── Main.hs
├── examples
├── README.md
├── books.xml
├── composing-multiple-edits.jpg
├── examples.yaml
├── help.jpg
├── hs-fieldupdate.jpg
├── hs-frac.jpg
├── hs-ints-gt-10.jpg
├── hs-ints.jpg
├── hs-modname.jpg
├── hs-odd-ints.jpg
├── hs-string.jpg
├── json-review-string.jpg
├── json.jpg
├── list.html
├── quiz.json
├── regex.jpg
├── xml.jpg
└── yaml.jpg
├── refactorio.cabal
├── refactorio.png
├── src
├── Refactorio
│ ├── Conversions.hs
│ ├── Engine.hs
│ ├── FilenameFilter.hs
│ ├── Helpers.hs
│ ├── Legacy.hs
│ ├── Main.hs
│ ├── Prelude.hs
│ ├── Prelude
│ │ ├── Basic.hs
│ │ ├── C.hs
│ │ ├── Haskell.hs
│ │ ├── Html.hs
│ │ ├── JavaScript.hs
│ │ ├── Json.hs
│ │ ├── Xml.hs
│ │ └── Yaml.hs
│ ├── SpecialMode.hs
│ ├── Theme.hs
│ └── Types.hs
└── X
│ ├── Language
│ └── Haskell
│ │ ├── Exts.hs
│ │ ├── Exts
│ │ ├── CabalUtils.hs
│ │ ├── Prisms.hs
│ │ └── Prisms
│ │ │ └── Types.hs
│ │ └── Interpreter.hs
│ ├── Rainbow.hs
│ ├── Streaming.hs
│ └── Streaming
│ └── Files.hs
├── stack.yaml
└── test
└── Spec.hs
/.gitignore:
--------------------------------------------------------------------------------
1 | .stack-work
2 | TAGS
3 | tags
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright Superpowers Corp (c) 2018
2 |
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above
12 | copyright notice, this list of conditions and the following
13 | disclaimer in the documentation and/or other materials provided
14 | with the distribution.
15 |
16 | * Neither the name of Superpowers Corp nor the names of other
17 | contributors may be used to endorse or promote products derived
18 | from this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | help:
2 | @cat Makefile
3 |
4 | EXE=refactorio
5 |
6 | build:
7 | stack build
8 |
9 | clean:
10 | stack clean
11 |
12 | dist-clean:
13 | \rm -rf .stack-work
14 |
15 | ghcid:
16 | stack exec -- ghcid -c 'stack ghci' --restart stack.yaml
17 |
18 | ghcid-devel:
19 | stack exec -- ghcid \
20 | --command "stack ghci redstring" \
21 | --test "DevelMain.update"
22 |
23 | hlint:
24 | stack exec hlint .
25 |
26 | longboye-all:
27 | longboye imports app
28 | longboye imports src
29 | longboye imports test
30 | longboye pragmas app
31 | longboye pragmas src
32 | longboye pragmas test
33 |
34 | run:
35 | stack exec $(EXE) $(STACK_ARGS) -- refactorio $(ARGS)
36 |
37 | test:
38 | stack test
39 |
40 | watch:
41 | stack build --fast --file-watch
42 |
43 | watch-test:
44 | stack test --fast --file-watch
45 |
46 | b: build
47 | g: ghcid
48 | gd: ghcid-devel
49 | hl: hlint
50 | lba: longboye-all
51 | r: run
52 | w: watch
53 | t: test
54 | wt: watch-test
55 |
56 | .PHONY: test
57 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # refactorio
2 |
3 | ** PLEASE BE AWARE THIS IS ALPHA SOFTWARE AND NOT ONLY WILL THE API CHANGE BUT
4 | IT WILL PROBABLY EAT YOUR CHILDREN. YOU HAVE BEEN WARNED. **
5 |
6 | Lens based Haskell refactoring toolkit.
7 |
8 | 
9 |
10 | > Study after study shows that the very best designers produce structures that
11 | > are faster, smaller, simpler, clearer, and produced with less effort. The
12 | > differences between the great and the average approach an order of magnitude.
13 | >
14 | > - Fred Brooks
15 |
16 | ## Usage
17 |
18 | Refactorio - Optical Refactoring Tool
19 |
20 | Usage: refactorio [--io] EXPR [-t|--target TARGET] [-g|--glob GLOB]
21 | [--prelude MODULE] ([-a|--ask] | [-p|--preview] |
22 | [-m|--modify] | [--review] | [-s|--search]) ([--haskell|--hs]
23 | | [--html] | [--javascript|--js] | [--c] | [--json] | [--xml]
24 | | [--yaml])
25 |
26 | Available options:
27 | --io Add IO to expr type ('ByteString -> IO ByteString')
28 | EXPR A Haskell expression of type 'ByteString ->
29 | ByteString'
30 | -t,--target TARGET One or more files/directories to traverse (defaults
31 | to stdin, use '-' to force stdin)
32 | -g,--glob GLOB Glob matches to include (eg '*.ini', 'f??b?r.c')
33 | --prelude MODULE Use a specific Prelude module
34 | -a,--ask Ask before changing files (default)
35 | -p,--preview Only show the changes that would be made
36 | -m,--modify Make the changes and summarize changed filenames
37 | --review Make the changes and show details of changes
38 | -s,--search Activate alternate search mode (Haskell mode only
39 | right now)
40 | --haskell,--hs Include .hs files and make Haskell ops available
41 | --html Include .htm(l) files and make XML ops available
42 | --javascript,--js Include .js files and make JavaScript ops available
43 | --c Include .c files and make C ops available
44 | --json Include .json files and make JSON ops available
45 | --xml Include .xml files and make XML ops available
46 | --yaml Include .y(a)ml files and make YAML ops available
47 | -h,--help Show this help text
48 |
49 | ## Major Modes
50 |
51 | In all modes Refactorio traverses one or more files executing a `ByteString ->
52 | ByteString` function on them. For a given file if the function does not change
53 | the input then no output is logged for that file. If the function does change
54 | the file then what happens next is dependent on the mode.
55 |
56 | Any `ByteString -> ByteString` function definition will work, for example:
57 |
58 | BS.reverse
59 |
60 | BS.take 1024
61 |
62 | over convert Text.toUpper
63 |
64 | # or equivalently
65 | convert %~ Text.toUpper
66 |
67 | key "foo" . _Number *~ 3
68 |
69 | ### Ask Mode (-a / --ask)
70 |
71 | This is the default mode. In this mode Refactorio will show you the changes
72 | that it's about to make and prompt you on a file by file basis whether you want
73 | to accept the changes or not. If you accept, the file will be replaced, if not
74 | the file will be left intact (or you can 'Q'uit at any time).
75 |
76 | ### Preview Mode (-p / --preview)
77 |
78 | not touch any files. You can think of it sort of like a `--dry-run`.
79 | In this mode Refactorio will just show all the changes that it would make, but
80 |
81 | ### Review Mode (-r / --review)
82 |
83 | In this mode Refactorio will make changes to all files without asking but will
84 | show the full set of changes as they are made.
85 |
86 | ### Modify Mode (-m / --modify)
87 |
88 | This is basically a `--quiet` style mode that makes all changes without
89 | confirmation and just reports which files changed with no further details.
90 |
91 | ### Search Mode (-s / --search)
92 |
93 | This is a special mode which currently only works with
94 | `haskell-src-exts(-prisms)` which provide `SrcSpanInfo`s which represent the
95 | portion of the source code that a given feature occupies. This mode can be
96 | easily made to work with any other lenses that can provide access to similar
97 | information and we are exploring ways to broaden it's usefulness further.
98 |
99 | ## Examples
100 |
101 | Here are a few examples to whet your appetite. For more see
102 | [examples](examples/).
103 |
104 | ### JSON (via [lens-aeson](https://hackage.haskell.org/package/lens-aeson)):
105 |
106 | "Upper case the string values of the array found under 'quiz.sport.q1.options'."
107 |
108 | 
109 |
110 | ### YAML (same operators):
111 |
112 | "Multiply the value of the key 'version' by 32."
113 |
114 | 
115 |
116 | ### HTML (via [xml-html-conduit-lens](https://hackage.haskell.org/package/xml-html-conduit-lens))
117 |
118 | TODO: Find a good way to deal with HTML. (problems with each of `hexpat-lens`, `hexml-lens`, `xml-html-conduit-lens` and `xml-lens`)
119 |
120 | ### XML (also via [xml-html-conduit-lens](https://hackage.haskell.org/package/xml-html-conduit-lens))
121 |
122 | C'mon, you've never needed to "find all the authors with names longer than 15
123 | characters and then sort all of the letters in their name that are above 'm' in
124 | place?" Pshaw.
125 |
126 | 
127 |
128 | ### Regex (via [lens-regex](https://hackage.haskell.org/package/lens-regex)):
129 |
130 | Drop regex's in anywhere you like, eg. "uppercase and reverse the characters in
131 | the value of the JSON object at this key that match this regular expression":
132 |
133 | 
134 |
135 | ### Compressed Files (via [zlib-lens](https://hackage.haskell.org/package/zlib-lens)):
136 |
137 | Reach inside eg. gzipped files and do what you gotta do:
138 |
139 |
140 |
141 | Example is temporarily unavailable, but goes something like:
142 |
143 | refactorio -t foo.json.gz --json 'convert . from Z.gzipped . from convert . key \"baz\" . _Number *~ 85'
144 |
145 |
146 |
147 | ### Type Conversions
148 |
149 | The beginnings of `convert` and `convertTo/convertFrom` (along with `a`/`an`)
150 | exist which can be used like so:
151 |
152 | When types can be infered:
153 |
154 | % refactorio --html -t /tmp/voltron/src 'convert %~ Text.toUpper'
155 |
156 | When types have to be clarified:
157 |
158 | % refactorio --html -t /tmp/voltron/src 'convertTo(a::LByteString).xml...name %~ Text.toUpper'
159 |
160 | ### Haskell (via [haskell-src-exts](https://hackage.haskell.org/package/haskell-src-exts) and [haskell-src-exts-prisms](https://hackage.haskell.org/package/haskell-src-exts-prisms)):
161 |
162 | TODO: revamp after re-wiring
163 |
164 | Try these on your projects:
165 |
166 | refactorio --haskell _Module.biplate._ModuleName.end
167 | refactorio --haskell _Module.biplate._Int.end
168 | refactorio --haskell _Module.biplate._String.end
169 | refactorio --haskell _Module.biplate._FieldUpdate.end
170 | refactorio --haskell _Module.biplate._Frac.end
171 | refactorio --haskell '_Module.biplate._Int.filtered(odd.view target).end'
172 | refactorio --haskell '_Module.biplate._Int.filtered(even.view target).end'
173 | refactorio --haskell '_Module.biplate._Int.filtered((>10).view target).end'
174 |
175 | There are [more examples here](examples/).
176 |
177 | ## Pro-Tip
178 |
179 | For now the easiest way to get it working is to `stack install .` in this
180 | directory. Then commands like this should work:
181 |
182 | refactorio --json 'key "foo" . key "bar" . _Number *~ 15' -t ./examples
183 |
184 | or
185 |
186 | cat Somefile.hs | refactorio -s --haskell _Module.biplate._ModuleName.end -
187 |
188 | (where the `-t`/`--target` is a file or directory to process and can be outside
189 | of the refactorio project root).
190 |
191 | ## Warnings
192 |
193 | In addition to the general warning about this being alpha quality software, no
194 | work has been done on performance and in fact in some cases even reasonable
195 | performance has been sacrificed in the name of expediency.
196 |
197 | In some places I've resorted to outright hacks, such as when parsing YAML by
198 | reading it as YAML, writing it as JSON for processing it with `lens-aeson`,
199 | then converting it back.
200 |
201 | In addition to being slow some of these tricks will do things like cause a file
202 | to be reformatted by the serialization round-trip even if your function doesn't
203 | make an actual semantic change.
204 |
205 | ## Configurable Format-specific Preludes
206 |
207 | Refactorio has a hardcoded set of qualified imports which you can find
208 | [somewhere around
209 | here](https://github.com/SuperpowersCorp/refactorio/blob/master/src/X/Language/Haskell/Interpreter.hs#L30).
210 |
211 | Currently the only unqualified import that Refactorio mandates is
212 | `Text.Regex.Quote` which brings the `r` QuasiQuoter into scope.
213 |
214 | In addition Refactorio attempts to load a single "Prelude" which can bring
215 | unqualified names into scope. Various lens packages for different formats have
216 | conflicting imports (eg. _String in `lens-aeson` and in
217 | `haskell-src-exts-prisms`) so to avoid conflicts for now if you pass a "special
218 | mode" flag (eg. `--haskell`, `--json`, etc) Refactorio will attempt to use
219 | `Refactorio.Prelude.{ModeName}` (eg `Refactorio.Prelude.Haskell`, etc). If no
220 | special mode is provided, `Refactorio.Prelude.Basic` is used.
221 |
222 | ## Similar Projects
223 |
224 | - [hawk](https://github.com/gelisam/hawk)
225 |
--------------------------------------------------------------------------------
/Setup.hs:
--------------------------------------------------------------------------------
1 | import Distribution.Simple
2 | main = defaultMain
3 |
--------------------------------------------------------------------------------
/app/Main.hs:
--------------------------------------------------------------------------------
1 | module Main ( main ) where
2 |
3 | import Refactorio.Main ( main )
4 |
5 |
--------------------------------------------------------------------------------
/examples/README.md:
--------------------------------------------------------------------------------
1 | Refactorio Examples
2 | ===================
3 |
4 | help
5 | ----
6 |
7 | Current help output at screenshot generation time
8 |
9 | 
10 |
11 | json
12 | ----
13 |
14 | Increment the value at key 'baz' by 1962.
15 |
16 | 
17 |
18 | xml
19 | ---
20 |
21 | C'mon, you've never needed to "find all the authors with names longer
22 | than 15 characters and then sort all of the letters in their name that
23 | are above 'm' in place?" Pshaw.
24 |
25 | 
26 |
27 | regex
28 | -----
29 |
30 | Drop regex's in anywhere you like, eg. "uppercase and reverse the
31 | characters in the value of the JSON object at this key that match this
32 | regular expression":
33 |
34 | 
35 |
36 | composing-multiple-edits
37 | ------------------------
38 |
39 | 
40 |
41 | NB. in this example the JSON is roundtripped through the serialization
42 | process twice
43 |
44 | hs-ints
45 | -------
46 |
47 | 
48 |
49 | hs-modname
50 | ----------
51 |
52 | 
53 |
54 | hs-string
55 | ---------
56 |
57 | 
58 |
59 | hs-fieldupdate
60 | --------------
61 |
62 | 
63 |
64 | hs-frac
65 | -------
66 |
67 | 
68 |
69 | hs-odd-ints
70 | -----------
71 |
72 | 
73 |
74 | hs-ints-gt-10
75 | -------------
76 |
77 | 
78 |
79 | json-review-string
80 | ------------------
81 |
82 | 
--------------------------------------------------------------------------------
/examples/books.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Gambardella, Matthew
5 | XML Developer's Guide
6 | Computer
7 | 44.95
8 | 2000-10-01
9 | An in-depth look at creating applications
10 | with XML.
11 |
12 |
13 | Ralls, Kim
14 | Midnight Rain
15 | Fantasy
16 | 5.95
17 | 2000-12-16
18 | A former architect battles corporate zombies,
19 | an evil sorceress, and her own childhood to become queen
20 | of the world.
21 |
22 |
23 | Corets, Eva
24 | Maeve Ascendant
25 | Fantasy
26 | 5.95
27 | 2000-11-17
28 | After the collapse of a nanotechnology
29 | society in England, the young survivors lay the
30 | foundation for a new society.
31 |
32 |
33 | Corets, Eva
34 | Oberon's Legacy
35 | Fantasy
36 | 5.95
37 | 2001-03-10
38 | In post-apocalypse England, the mysterious
39 | agent known only as Oberon helps to create a new life
40 | for the inhabitants of London. Sequel to Maeve
41 | Ascendant.
42 |
43 |
44 | Corets, Eva
45 | The Sundered Grail
46 | Fantasy
47 | 5.95
48 | 2001-09-10
49 | The two daughters of Maeve, half-sisters,
50 | battle one another for control of England. Sequel to
51 | Oberon's Legacy.
52 |
53 |
54 | Randall, Cynthia
55 | Lover Birds
56 | Romance
57 | 4.95
58 | 2000-09-02
59 | When Carla meets Paul at an ornithology
60 | conference, tempers fly as feathers get ruffled.
61 |
62 |
63 | Thurman, Paula
64 | Splish Splash
65 | Romance
66 | 4.95
67 | 2000-11-02
68 | A deep sea diver finds true love twenty
69 | thousand leagues beneath the sea.
70 |
71 |
72 | Knorr, Stefan
73 | Creepy Crawlies
74 | Horror
75 | 4.95
76 | 2000-12-06
77 | An anthology of horror stories about roaches,
78 | centipedes, scorpions and other insects.
79 |
80 |
81 | Kress, Peter
82 | Paradox Lost
83 | Science Fiction
84 | 6.95
85 | 2000-11-02
86 | After an inadvertant trip through a Heisenberg
87 | Uncertainty Device, James Salway discovers the problems
88 | of being quantum.
89 |
90 |
91 | O'Brien, Tim
92 | Microsoft .NET: The Programming Bible
93 | Computer
94 | 36.95
95 | 2000-12-09
96 | Microsoft's .NET initiative is explored in
97 | detail in this deep programmer's reference.
98 |
99 |
100 | O'Brien, Tim
101 | MSXML3: A Comprehensive Guide
102 | Computer
103 | 36.95
104 | 2000-12-01
105 | The Microsoft MSXML3 parser is covered in
106 | detail, with attention to XML DOM interfaces, XSLT processing,
107 | SAX and more.
108 |
109 |
110 | Galos, Mike
111 | Visual Studio 7: A Comprehensive Guide
112 | Computer
113 | 49.95
114 | 2001-04-16
115 | Microsoft Visual Studio 7 is explored in depth,
116 | looking at how Visual Basic, Visual C++, C#, and ASP+ are
117 | integrated into a comprehensive development
118 | environment.
119 |
120 |
121 |
--------------------------------------------------------------------------------
/examples/composing-multiple-edits.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/composing-multiple-edits.jpg
--------------------------------------------------------------------------------
/examples/examples.yaml:
--------------------------------------------------------------------------------
1 | settings:
2 | target: ../example-data
3 | # exe: "stack exec refactorio --" # TODO: This is currently hardcoded
4 | examples:
5 | - name: "help"
6 | cmd: "$EXE --help"
7 | pre: "Current help output at screenshot generation time"
8 | version: 0
9 | - name: "json"
10 | pre: "Increment the value at key 'baz' by 1962."
11 | cmd: "$EXE -p -t $TARGET --json 'key \"quiz\" . key \"sport\" . key \"q1\" . key \"options\" . _Array . each . _String %~ Text.toUpper'"
12 | version: 0
13 | # - name: yaml
14 | # pre: "Multiply the value of the key 'baz' by 10."
15 | # cmd: "$EXE -t $TARGET/examples.yaml -p --yaml 'yaml . key \"examples\" ... key \"version\" . _Number +~ 32' | head -40"
16 | # version: 0
17 | # - name: html
18 | # pre: "HTML example coming soon."
19 | # cmd: "echo HTML makes me sad - real example coming soon."
20 | # version: 0
21 | - name: xml
22 | pre: "C'mon, you've never needed to \"find all the authors with names longer than 15 characters and then sort all of the letters in their name that are above 'm' in place?\" Pshaw."
23 | cmd: "$EXE -t $TARGET/books.xml -p --xml 'convertTo(a::LByteString) . xml . node \"book\" . node \"author\" . text . filtered ((>12) . Text.length) . partsOf (each.filtered (>Prelude.head \"m\")) %~ sort'"
24 | version: 0
25 | - name: regex
26 | pre: "Drop regex's in anywhere you like, eg. \"uppercase and reverse the characters in the value of the JSON object at this key that match this regular expression\":"
27 | cmd: "$EXE -t $TARGET -p --json 'key \"quiz\" . key \"sport\" . key \"q1\" . key \"answer\" . _String . Text.unpacked . regex [r|[aeiou]|] . matchedString %~ map Char.toUpper'"
28 | version: 0
29 | # - name: zlib
30 | # pre: "Reach inside eg. gzipped files and do what you gotta do:"
31 | # post: "(Not sure what's up with that \"trailing garbage.\")"
32 | # cmd: "cat $TARGET/b.json.gz | $EXE -t - --json 'convert . from Z.gzipped . from convert . key \"baz\" . _Number *~ 85' | gzcat -"
33 | # version: 0
34 | - name: composing-multiple-edits
35 | cmd: "$EXE -p -t $TARGET/quiz.json --json '(key \"quiz\" . key \"sport\" . key \"q1\" . key \"answer\" . _String %~ Text.toUpper) . (key \"quiz\" . key \"maths\" . key \"q2\" . key \"options\" . _Array . traverse . _String .~ \"censored\")'"
36 | post: NB. in this example the JSON is roundtripped through the serialization process twice
37 | version: 0
38 | - name: hs-ints
39 | cmd: "$EXE -t src/Refactorio/Engine.hs --search --haskell _Module.biplate._Int.end"
40 | version: 0
41 | - name: hs-modname
42 | cmd: "$EXE -t src/Refactorio/Main.hs --search --haskell _Module.biplate._ModuleName.end"
43 | version: 0
44 | - name: hs-string
45 | cmd: "$EXE -t src/Refactorio/Main.hs --search --haskell _Module.biplate._String.end | head -40"
46 | version: 0
47 | - name: hs-fieldupdate
48 | cmd: "$EXE -t src/Refactorio/Theme.hs --search --haskell _Module.biplate._FieldUpdate.end"
49 | version: 0
50 | - name: hs-frac
51 | cmd: "$EXE -t src --search --haskell _Module.biplate._Frac.end"
52 | version: 0
53 | - name: hs-odd-ints
54 | cmd: "$EXE -t src/Refactorio/Legacy.hs --search --haskell '_Module.biplate._Int.filtered(odd.view target).end'"
55 | version: 0
56 | - name: hs-ints-gt-10
57 | cmd: "$EXE -t src --search --haskell '_Module.biplate._Int.filtered((>10).view target).end'"
58 | version: 0
59 | - name: json-review-string
60 | cmd: "$EXE -p -t $TARGET/quiz.json --json 'key \"quiz\" . members .~ _String # \"DELETED\"'"
61 | version: 0
62 | # - name: decimal
63 | # cmd: "$EXE -t - 'convert.decimal +~ 1'"
64 | # stdin: "10"
65 | # version: 0
66 |
--------------------------------------------------------------------------------
/examples/help.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/help.jpg
--------------------------------------------------------------------------------
/examples/hs-fieldupdate.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/hs-fieldupdate.jpg
--------------------------------------------------------------------------------
/examples/hs-frac.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/hs-frac.jpg
--------------------------------------------------------------------------------
/examples/hs-ints-gt-10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/hs-ints-gt-10.jpg
--------------------------------------------------------------------------------
/examples/hs-ints.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/hs-ints.jpg
--------------------------------------------------------------------------------
/examples/hs-modname.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/hs-modname.jpg
--------------------------------------------------------------------------------
/examples/hs-odd-ints.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/hs-odd-ints.jpg
--------------------------------------------------------------------------------
/examples/hs-string.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/hs-string.jpg
--------------------------------------------------------------------------------
/examples/json-review-string.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/json-review-string.jpg
--------------------------------------------------------------------------------
/examples/json.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/json.jpg
--------------------------------------------------------------------------------
/examples/list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | An Unordered HTML List
6 |
7 |
8 | - Coffee
9 | - Tea
10 | - Milk
11 |
12 |
13 | An Ordered HTML List
14 |
15 |
16 | - Coffee
17 | - Tea
18 | - Milk
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/examples/quiz.json:
--------------------------------------------------------------------------------
1 | {"pi":3.1415926535,"version":"1.2.3","quiz":{"sport":{"q1":{"answer":"Huston Rocket","options":["New York Bulls","Los Angeles Kings","Golden State Warriros","Huston Rocket"],"question":"Which one is correct team name in NBA?"}},"maths":{"q2":{"answer":"4","options":["1","2","3","4"],"question":"12 - 8 = ?"},"q1":{"answer":"12","options":["10","11","12","13"],"question":"5 + 7 = ?"}}}}
2 |
--------------------------------------------------------------------------------
/examples/regex.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/regex.jpg
--------------------------------------------------------------------------------
/examples/xml.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/xml.jpg
--------------------------------------------------------------------------------
/examples/yaml.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/examples/yaml.jpg
--------------------------------------------------------------------------------
/refactorio.cabal:
--------------------------------------------------------------------------------
1 | name: refactorio
2 | version: 0.1.0.0
3 | synopsis: Lens-based refactoring toolkit.
4 | description: The synopsis pretty much covers it.
5 | homepage: https://github.com/SuperpowersCorp/refactorio#readme
6 | license: BSD3
7 | license-file: LICENSE
8 | author: Superpowers Corp
9 | maintainer: john@superpowerscorp.com
10 | copyright: 2018 Superpowers Corp
11 | category: Web
12 | build-type: Simple
13 | extra-source-files: README.md
14 | cabal-version: >=1.10
15 |
16 | library
17 | hs-source-dirs: src
18 | ghc-options: -Wall
19 | -Wcompat
20 | -Wincomplete-record-updates
21 | -Wincomplete-uni-patterns
22 | -Wredundant-constraints
23 | exposed-modules: Refactorio.Conversions
24 | , Refactorio.Engine
25 | , Refactorio.FilenameFilter
26 | , Refactorio.Helpers
27 | , Refactorio.Main
28 | , Refactorio.Legacy
29 | , Refactorio.Prelude
30 | , Refactorio.Prelude.Basic
31 | , Refactorio.Prelude.C
32 | , Refactorio.Prelude.Haskell
33 | , Refactorio.Prelude.Html
34 | , Refactorio.Prelude.JavaScript
35 | , Refactorio.Prelude.Json
36 | , Refactorio.Prelude.Xml
37 | , Refactorio.Prelude.Yaml
38 | , Refactorio.SpecialMode
39 | , Refactorio.Theme
40 | , Refactorio.Types
41 | , X.Language.Haskell.Exts
42 | , X.Language.Haskell.Exts.Prisms
43 | , X.Language.Haskell.Exts.Prisms.Types
44 | , X.Language.Haskell.Interpreter
45 | , X.Rainbow
46 | , X.Streaming.Files
47 | build-depends: Cabal
48 | , Diff
49 | , Glob
50 | , aeson
51 | , base >= 4.7 && < 5
52 | , bytestring
53 | , containers
54 | , data-default
55 | , directory
56 | , exceptions
57 | , haskell-src-exts
58 | , haskell-src-exts-prisms
59 | , hexml-lens
60 | , hexpat-lens
61 | , hint
62 | , language-c-optics
63 | , language-javascript-optics
64 | , lens
65 | , lens-aeson
66 | , lens-regex
67 | , number-show
68 | , optparse-applicative
69 | , pandoc
70 | , pandoc-lens
71 | , pandoc-types
72 | , pretty
73 | , process
74 | , profunctors
75 | , protolude
76 | , rainbow
77 | , regex-pcre-builtin
78 | , safe
79 | , streaming
80 | , string-conv
81 | , taggy-lens
82 | , text
83 | , unix
84 | , versions
85 | , vty
86 | , xml-conduit
87 | , xml-html-conduit-lens
88 | , xml-lens
89 | , yaml
90 | , zlib-lens
91 | default-language: Haskell2010
92 |
93 | executable refactorio
94 | hs-source-dirs: app
95 | main-is: Main.hs
96 | ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
97 | build-depends: Cabal
98 | , Diff
99 | , Glob
100 | , aeson
101 | , base
102 | , bytestring
103 | , containers
104 | , data-default
105 | , directory
106 | , exceptions
107 | , hexml-lens
108 | , hexpat-lens
109 | , hint
110 | , language-c-optics
111 | , language-javascript-optics
112 | , lens
113 | , lens-aeson
114 | , lens-regex
115 | , number-show
116 | , optparse-applicative
117 | , pandoc
118 | , pandoc-lens
119 | , pandoc-types
120 | , pretty
121 | , process
122 | , profunctors
123 | , protolude
124 | , refactorio
125 | , regex-pcre-builtin
126 | , taggy-lens
127 | , text
128 | , unix
129 | , versions
130 | , vty
131 | , xml-conduit
132 | , xml-html-conduit-lens
133 | , xml-lens
134 | , yaml
135 | , zlib-lens
136 | default-language: Haskell2010
137 |
138 | test-suite refactorio-test
139 | type: exitcode-stdio-1.0
140 | hs-source-dirs: test
141 | main-is: Spec.hs
142 | ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
143 | build-depends: Cabal
144 | , Diff
145 | , Glob
146 | , QuickCheck
147 | , aeson
148 | , base
149 | , bytestring
150 | , containers
151 | , data-default
152 | , directory
153 | , exceptions
154 | , hexml-lens
155 | , hexpat-lens
156 | , hint
157 | , hspec
158 | , language-c-optics
159 | , language-javascript-optics
160 | , lens
161 | , lens-aeson
162 | , lens-regex
163 | , number-show
164 | , pandoc
165 | , pandoc-lens
166 | , pandoc-types
167 | , pretty
168 | , process
169 | , profunctors
170 | , protolude
171 | , refactorio
172 | , regex-pcre-builtin
173 | , taggy-lens
174 | , text
175 | , unix
176 | , versions
177 | , vty
178 | , xml-conduit
179 | , xml-html-conduit-lens
180 | , xml-lens
181 | , yaml
182 | , zlib-lens
183 | default-language: Haskell2010
184 |
185 | source-repository head
186 | type: git
187 | location: https://github.com/SuperpowersCorp/refactorio
188 |
--------------------------------------------------------------------------------
/refactorio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SuperpowersCorp/refactorio/6d7ae3f67ac896172760079b5813089be3d30802/refactorio.png
--------------------------------------------------------------------------------
/src/Refactorio/Conversions.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE FlexibleInstances #-}
2 | {-# LANGUAGE MultiParamTypeClasses #-}
3 | {-# LANGUAGE NoImplicitPrelude #-}
4 | {-# LANGUAGE OverloadedStrings #-}
5 | {-# LANGUAGE RankNTypes #-}
6 |
7 | module Refactorio.Conversions
8 | ( Convert(..)
9 | , a
10 | , an
11 | , convertFrom
12 | , convertTo
13 | , isoAs
14 | ) where
15 |
16 | import Control.Lens as L
17 | import Data.ByteString as BS
18 | import Data.ByteString.Lazy as LBS
19 | import Data.String as S
20 | import Data.Text as T
21 | import Data.Text.Encoding as TE
22 | import Data.Text.Lazy as LT
23 | import Data.Text.Lens as TL
24 | import Protolude hiding ( from )
25 |
26 | a :: a
27 | a = panic "witness used inappropriately."
28 |
29 | an :: a
30 | an = a
31 |
32 | -- | Useful when target type is ambiguous, like so:
33 | --
34 | -- % refio --html -t /tmp/foo '& convertTo(a::LByteString).xml...name %~ Text.toUpper'
35 | --
36 | convertTo :: Convert a b => b -> Iso' a b
37 | convertTo _ = convert
38 |
39 | convertFrom :: Convert a b => a -> Iso' a b
40 | convertFrom _ = convert
41 |
42 | isoAs :: a -> Iso' a a
43 | isoAs _ = iso identity identity
44 |
45 | class Convert a b where
46 | convert :: Iso' a b
47 |
48 | instance Convert a a where
49 | convert = iso identity identity
50 |
51 | instance Convert BS.ByteString LBS.ByteString where
52 | convert = iso LBS.fromStrict LBS.toStrict
53 |
54 | instance Convert LBS.ByteString BS.ByteString where
55 | convert = iso LBS.toStrict LBS.fromStrict
56 |
57 | instance Convert T.Text LT.Text where
58 | convert = iso LT.fromStrict LT.toStrict
59 |
60 | instance Convert LT.Text T.Text where
61 | convert = iso LT.toStrict LT.fromStrict
62 |
63 | instance Convert BS.ByteString T.Text where
64 | convert = iso TE.decodeUtf8 TE.encodeUtf8
65 |
66 | instance Convert T.Text BS.ByteString where
67 | convert = from convert
68 |
69 | instance Convert S.String T.Text where
70 | convert = packed
71 |
72 | instance Convert S.String LT.Text where
73 | convert = packed
74 |
75 | instance Convert T.Text S.String where
76 | convert = unpacked
77 |
78 | instance Convert LT.Text S.String where
79 | convert = unpacked
80 |
81 | instance Convert BS.ByteString LT.Text where
82 | convert = convertTo (a :: T.Text) . convertTo (a :: LT.Text)
83 |
84 | instance Convert BS.ByteString String where
85 | convert = convertTo (a :: T.Text) . unpacked
86 |
87 | instance Convert String BS.ByteString where
88 | convert = from convert
89 |
--------------------------------------------------------------------------------
/src/Refactorio/Engine.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE LambdaCase #-}
2 | {-# LANGUAGE NoImplicitPrelude #-}
3 | {-# LANGUAGE OverloadedStrings #-}
4 | {-# LANGUAGE RecordWildCards #-}
5 |
6 | module Refactorio.Engine ( process ) where
7 |
8 | import Refactorio.Prelude as P hiding ( (<>) )
9 | import qualified Streaming.Prelude as S
10 |
11 | import Data.Algorithm.DiffContext
12 | import qualified Data.ByteString as BS
13 | import qualified Data.ByteString.Char8 as C8
14 | import qualified Data.Set as Set
15 | import qualified Data.Text as T
16 | import Refactorio.FilenameFilter
17 | import qualified Refactorio.Legacy as Legacy
18 | import Refactorio.SpecialMode
19 | import Refactorio.Types
20 | import System.IO ( hFlush
21 | , stdout
22 | )
23 | import System.Posix.Files
24 | import Text.PrettyPrint as PP hiding ( (<>) )
25 | import X.Language.Haskell.Interpreter ( GhcError( errMsg )
26 | , InterpreterError(..)
27 | , build
28 | )
29 | import X.Rainbow
30 | import X.Streaming.Files ( tree )
31 | import System.Posix.Terminal (queryTerminal)
32 | import System.Posix.IO (stdOutput)
33 |
34 | process :: Config -> IO ()
35 | process config@Config{..}
36 | | mixingStdin targets = errorCannotMix . toList $ targets
37 | | updateMode == SearchMode = Legacy.search config
38 | | otherwise = describeProcess config >> buildMapFn config >>= \case
39 | Left err -> errorInExpression expr err
40 | Right f -> forM_ targets $
41 | S.mapM_ (processFile updateMode f)
42 | . S.filter ( matchesAny compiledFilters )
43 | . S.filter ( not . ignored )
44 | . S.map fst
45 | . S.filter ( not . isDirectory . snd )
46 | . tree
47 | . unTarget
48 | where
49 | compiledFilters = map compileFilter . Set.toList . allFilters $ config
50 |
51 | -- TODO: read .*ignore files from the target dir down to the current file, caching
52 | -- along the way, etc. but for now...
53 | ignored :: FilePath -> Bool
54 | ignored path = any ($ path)
55 | [ (`contains` ".stack-work")
56 | , (`startsWith` ".git/")
57 | , (`contains` "/.git/")
58 | ]
59 |
60 | processFile :: UpdateMode -> MappingFn -> FilePath -> IO ()
61 | processFile updateMode (MapFn f) path = processFile updateMode (MapMFn $ return . f) path
62 | processFile updateMode (MapMFn mf) path = do
63 | beforeBytes <- case path of
64 | "-" -> BS.hGetContents stdin
65 | other -> BS.readFile other
66 | afterBytes <- mf beforeBytes
67 | let doc = prettyContextDiff beforeName afterName elPrint diff'
68 | diff' = getContextDiff ctxLines beforeLines afterLines
69 | beforeLines = C8.lines beforeBytes
70 | afterLines = C8.lines afterBytes
71 | if path == "-"
72 | then saveChanges afterBytes
73 | else when (beforeBytes /= afterBytes) $ case updateMode of
74 | -- TODO: doublecheck (gh-6) here.
75 | AskMode -> showChanges "Preview" doc >> changePrompt >>= \case
76 | AcceptChange -> saveChanges afterBytes >> putLn ("Saved: " <> show path)
77 | RejectChange -> putLn "File unchanged."
78 | QuitChanges -> putLn "Exiting at user's request." >> exitSuccess
79 | ModifyMode -> saveChanges afterBytes >> putLn ("Changed: " <> show path)
80 | Nope -> putLn "File unchanged."
81 | PreviewMode -> showChanges "Preview" doc
82 | ReviewMode -> saveChanges afterBytes >> showChanges "Review" doc
83 | SearchMode -> panic "we should not be in processFile in SearchMode"
84 | where
85 | ctxLines = 2
86 |
87 | saveChanges :: ByteString -> IO ()
88 | saveChanges bs
89 | | path == "-" = BS.putStr bs
90 | | otherwise = do
91 | putLn $ "Saving changes to " <> T.pack path
92 | BS.writeFile path bs
93 |
94 | -- TODO: DRY up/simplify the color vs. BW stuff.
95 | showChanges :: Text -> Doc -> IO ()
96 | showChanges label doc = queryTerminal stdOutput >>= \case
97 | True -> showChangesColor label doc
98 | False -> showChangesBW label doc
99 |
100 | showChangesBW :: Text -> Doc -> IO ()
101 | showChangesBW label doc = do
102 | nl
103 | putLn $ label <> " of changes to: " <> show path
104 | putLn divider
105 | bwDisplay doc
106 | where
107 | divider = T.pack . replicate 64 $ '='
108 |
109 | showChangesColor :: Text -> Doc -> IO ()
110 | showChangesColor label doc = do
111 | nl
112 | putChunkLn $ (chunk . unpack $ label <> " of changes to: " <> show path) & fore yellow
113 | putChunkLn $ chunk divider & fore yellow
114 | colorDisplay doc
115 | where
116 | divider = T.pack . replicate 64 $ '='
117 |
118 | beforeName :: Doc
119 | beforeName = PP.text $ path <> " BEFORE"
120 |
121 | afterName :: Doc
122 | afterName = PP.text $ path <> " AFTER"
123 |
124 | elPrint :: ByteString -> Doc
125 | elPrint = PP.text . unpack . decodeUtf8
126 |
127 | colorDisplay :: Doc -> IO ()
128 | colorDisplay = mapM_ colorLn . T.lines . render'
129 | where
130 | colorLn :: Text -> IO ()
131 | colorLn s
132 | | s `startsWith` "-" = putChunkLn $ chunk s & fore red
133 | | s `startsWith` "+" = putChunkLn $ chunk s & fore green
134 | | otherwise = putChunkLn $ chunk s & fore grey
135 |
136 | render' :: Doc -> Text
137 | render' = T.pack . PP.render
138 |
139 | bwDisplay :: Doc -> IO ()
140 | bwDisplay = mapM_ colorLn . T.lines . render'
141 | where
142 | colorLn :: Text -> IO ()
143 | colorLn s
144 | | s `startsWith` "-" = putLn s
145 | | s `startsWith` "+" = putLn s
146 | | otherwise = putLn s
147 |
148 | render' :: Doc -> Text
149 | render' = T.pack . PP.render
150 |
151 | allFilters :: Config -> Set FilenameFilter
152 | allFilters Config{..}
153 | | isStdin = Set.empty
154 | | otherwise = expandExtraFilters specialModeMay filenameFilters
155 | where
156 | isStdin = targets == Target "-" :| []
157 |
158 | buildMapFn :: Config -> IO (Either InterpreterError MappingFn)
159 | buildMapFn config@Config{..}
160 | | monadic = MapMFn <<$>> buildFn
161 | | otherwise = MapFn <<$>> buildFn
162 | where
163 | buildFn :: Typeable a => IO (Either InterpreterError a)
164 | buildFn = build (preludesFrom config) (unExpression expr)
165 |
166 | changePrompt :: IO ChangeChoice
167 | changePrompt = do
168 | putStr ("Accept change (Y/N/Q)? " :: Text)
169 | hFlush stdout
170 | (T.toLower <$> getLn) >>= \case
171 | "y" -> return AcceptChange
172 | "yes" -> return AcceptChange
173 | "n" -> return RejectChange
174 | "no" -> return RejectChange
175 | "q" -> return QuitChanges
176 | "quit" -> return QuitChanges
177 | _ -> changePrompt
178 |
179 | customPrelude :: SpecialMode -> Maybe FilePath
180 | customPrelude m = Just $ "Refactorio.Prelude." <> show m
181 |
182 | describeProcess :: Config -> IO ()
183 | describeProcess config@Config{..} = do
184 | case specialModeMay of
185 | Nothing -> return ()
186 | Just mode -> putLnMay $ "Special processing activated: " <> show mode
187 | putLnMay $ "Targets: " <> show (map unTarget . toList $ targets)
188 | putLnMay $ if null filters
189 | then "No filters."
190 | else "Filters: " <> show (map unFilenameFilter . Set.toList $ filters)
191 | putLnMay $ "Preludes: " <> show (preludesFrom config)
192 | putLnMay $ "Expression: " <> unExpression expr
193 | hFlush stdout
194 | where
195 | filters = allFilters config
196 |
197 | putLnMay s
198 | | toList targets == [Target "-"] = return ()
199 | | otherwise = putLn s
200 |
201 | mixingStdin :: NonEmpty Target -> Bool
202 | mixingStdin xs = length xs > 1 && Target "-" `elem` toList xs
203 |
204 | preludesFrom :: Config ->[String]
205 | preludesFrom Config{..} = catMaybes
206 | [ preludeModuleMay
207 | , join $ customPrelude <$> specialModeMay
208 | , defaultPrelude
209 | ]
210 | where
211 | defaultPrelude = Just "Refactorio.Prelude.Basic"
212 |
213 | reportError :: Text -> Text -> IO ()
214 | reportError hdr msg = byteStringMakerFromEnvironment >>= \maker ->
215 | mapM_ (BS.hPutStr stderr) . chunksToByteStrings maker $
216 | [ chunk hdr & fore c
217 | , chunk msg & fore c
218 | , nlc
219 | ]
220 | where
221 | c = red -- TODO: theme
222 |
223 | nlc :: Chunk Text
224 | nlc = chunk "\n"
225 |
226 | errorCannotMix :: [Target] -> IO ()
227 | errorCannotMix targets = reportError hdr msg
228 | where
229 | hdr = "Invalid target set:\n\n " <> show (map unTarget targets) <> "\n"
230 | msg = "You cannot mix stdin '-' with other targets."
231 |
232 | errorInExpression :: Expression -> InterpreterError -> IO ()
233 | errorInExpression expr e = reportError hdr msg
234 | where
235 | hdr = "Failed to compile expression:\n\n " <> unExpression expr <> "\n\n"
236 |
237 | msg = T.pack $ case e of
238 | GhcException s -> "GHC Exception:\n\n" <> s
239 | NotAllowed s -> "Not Allowed:\n\n" <> s
240 | UnknownError s -> "Unknown Error:\n\n" <> s
241 | WontCompile ghcErrors -> "GHC Errors:\n\n" <> intercalate "\n" errors
242 | where
243 | errors = map errMsg ghcErrors
244 |
--------------------------------------------------------------------------------
/src/Refactorio/FilenameFilter.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE DeriveDataTypeable #-}
2 | {-# LANGUAGE NoImplicitPrelude #-}
3 | {-# LANGUAGE OverloadedStrings #-}
4 |
5 | module Refactorio.FilenameFilter
6 | ( FilenameFilter(..)
7 | , compileFilter
8 | , devMatchesAnyString -- For dev
9 | , expandExtraFilters
10 | , matches
11 | , matchesAny
12 | ) where
13 |
14 | import Refactorio.Prelude hiding ( empty
15 | , null
16 | )
17 |
18 | import Data.Data ( Data )
19 | import Data.List ( null )
20 | import Data.Set ( empty
21 | , fromList
22 | )
23 | import Data.Text ( pack )
24 | import Refactorio.SpecialMode
25 | import System.FilePath.Glob ( Pattern
26 | , compile
27 | , match
28 | )
29 |
30 | newtype FilenameFilter = FilenameFilter { unFilenameFilter :: Text }
31 | deriving (Data, Eq, Ord, Read, Show, Typeable)
32 |
33 | type CompiledFilter = Pattern
34 |
35 | compileFilter :: FilenameFilter -> CompiledFilter
36 | compileFilter = compile . unpack . unFilenameFilter
37 |
38 | devMatchesAnyString :: [String] -> FilePath -> Bool
39 | devMatchesAnyString = matchesAny . map (compileFilter . FilenameFilter . pack)
40 |
41 | expandExtraFilters :: Maybe SpecialMode -> Set FilenameFilter -> Set FilenameFilter
42 | expandExtraFilters specialModeMay existing
43 | | not . null $ existing = existing
44 | | otherwise = maybe empty filtersForSpecialMode specialModeMay
45 |
46 | filtersForSpecialMode :: SpecialMode -> Set FilenameFilter
47 | filtersForSpecialMode m = fromList . map FilenameFilter $ case m of
48 | C -> [ "**/*.c", "**/*.h" ]
49 | Haskell -> [ "**/*.hs" ]
50 | Html -> [ "**/*.html", "**/*.xhtml", "**/*.htm" ]
51 | JavaScript -> [ "**/*.js" ]
52 | Json -> [ "**/*.json" ]
53 | Xml -> [ "**/*.xml" ]
54 | Yaml -> [ "**/*.yaml"
55 | , "**/*.yml"
56 | ]
57 |
58 | matches :: CompiledFilter -> FilePath -> Bool
59 | matches = match
60 |
61 | matchesAny :: [CompiledFilter] -> FilePath -> Bool
62 | matchesAny filters path
63 | | null filters = True
64 | | otherwise = any (`matches` path) filters
65 |
--------------------------------------------------------------------------------
/src/Refactorio/Helpers.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 | {-# LANGUAGE OverloadedStrings #-}
3 | {-# LANGUAGE RankNTypes #-}
4 | {-# OPTIONS_GHC -fno-warn-deprecations #-}
5 | {-# OPTIONS_GHC -fno-warn-orphans #-}
6 |
7 | module Refactorio.Helpers
8 | ( debugL
9 | , hs
10 | , yaml
11 | ) where
12 |
13 | import Refactorio.Prelude
14 |
15 | import qualified Data.Aeson as Json
16 | import qualified Data.Yaml as Yaml
17 | import Refactorio.Conversions ( a
18 | , convert
19 | , convertTo
20 | )
21 | import Text.Xml.Lens ( AsHtmlDocument
22 | , _HtmlDocument
23 | )
24 | import X.Language.Haskell.Exts ( hs )
25 |
26 | instance AsHtmlDocument ByteString where
27 | _HtmlDocument = convertTo (a :: LByteString) . _HtmlDocument
28 |
29 | -- | You can drop this into the middle of a composed lens ala...
30 | --
31 | -- a . b . debugL "hi there " . c . d
32 | --
33 | -- and you will get a log message like "hi there (blah)" where blah is
34 | -- the output of lens `b`.
35 | debugL :: Show a => Text -> Iso' a a
36 | debugL label = iso g s
37 | where
38 | g :: Show a => a -> a
39 | g x = trace msg x
40 | where
41 | msg = label <> " " <> show x
42 |
43 | s :: Show a => a -> a
44 | s x = trace msg x
45 | where
46 | msg = label <> " " <> show x
47 |
48 | yaml :: Iso' ByteString ByteString
49 | yaml = iso g s
50 | where
51 | g :: ByteString -> ByteString
52 | g = view (from convert) . Json.encode . yamlBsToValue
53 |
54 | yamlBsToValue :: ByteString -> Json.Value
55 | yamlBsToValue = either (panic . ("YAML decoding failure: " <>) . show) identity
56 | . Yaml.decodeEither
57 |
58 | s :: ByteString -> ByteString
59 | s = (Yaml.encode :: Maybe Json.Value -> ByteString)
60 | . (Json.decode :: LByteString -> Maybe Json.Value)
61 | . view convert
62 |
--------------------------------------------------------------------------------
/src/Refactorio/Legacy.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE LambdaCase #-}
2 | {-# LANGUAGE NoImplicitPrelude #-}
3 | {-# LANGUAGE OverloadedStrings #-}
4 | {-# LANGUAGE RecordWildCards #-}
5 |
6 | module Refactorio.Legacy where
7 |
8 | import Refactorio.Prelude as P hiding ( (<>) )
9 | import qualified Streaming.Prelude as S
10 |
11 | import qualified Data.List as L
12 | import qualified Data.Set as Set
13 | import qualified Data.Text as T
14 | import Language.Haskell.Exts
15 | import Language.Haskell.Interpreter
16 | import Refactorio.FilenameFilter
17 | import Refactorio.Theme
18 | import Refactorio.Types
19 | import X.Language.Haskell.Exts.Prisms ( configureParseMode
20 | , extractExtensions
21 | )
22 | import X.Language.Haskell.Interpreter ( build )
23 | import X.Rainbow
24 | import X.Streaming.Files ( FileInfo
25 | , tree
26 | )
27 |
28 | search :: Config -> IO ()
29 | search config@Config{..} = do
30 | putChunksLn
31 | [ chunk within & withinHdr theme
32 | , chunk (T.pack . show . map unTarget . toList $ targets) & withinValue theme
33 | ]
34 | putChunksLn
35 | [ chunk query & searchHdr theme
36 | , chunk (unExpression expr) & searchValue theme
37 | ]
38 | nl
39 | searchByLens config
40 | where
41 | within = "Searching within: "
42 | query = justify " for matches to: "
43 | justify s = T.replicate (T.length within - T.length s) " " <> s
44 | theme = defaultTheme
45 |
46 | -- searchFileByLens :: Config -> IO (Either InterpreterError MappingFn)
47 | -- searchFileByLens _config@Config{..} = makeLens (unExpression expr) >>= \case
48 | -- Left err -> panic . show $ err
49 | -- Right _trav -> panic "Right _trav undefined"
50 |
51 | searchByLens :: Config -> IO ()
52 | searchByLens Config {..} = makeLens (unExpression expr) >>= \case
53 | Left err -> print err
54 | Right trav -> forM_ targets $ \target ->
55 | S.mapM_ (showMatches trav)
56 | . S.chain reportFile
57 | . S.filter ( matchesAny compiledFilters . fst )
58 | . S.filter (\(p, _) -> ".hs" `L.isSuffixOf` p && not (".stack-work" `L.isInfixOf` p))
59 | . tree
60 | . unTarget
61 | $ target
62 | where
63 | showMatches t (p, _) = findMatches t p
64 | >>= mapM_ (\x -> printPrettily theme x >> nl)
65 |
66 | reportFile :: FileInfo -> IO ()
67 | reportFile (p, _) = putChunkLn (chunk (T.pack p) & filename theme)
68 | theme = defaultTheme
69 |
70 | -- TODO: dry up vs Engine
71 | allFilters = expandExtraFilters specialModeMay filenameFilters
72 | compiledFilters = map compileFilter . Set.toList $ allFilters
73 |
74 | makeLens :: Text -> IO (Either InterpreterError
75 | (ATraversal' (Module SrcSpanInfo) SrcSpanInfo))
76 | makeLens = build preludes
77 | where
78 | preludes = ["Refactorio.Prelude.Haskell"]
79 |
80 | findMatches :: ATraversal' (Module SrcSpanInfo) SrcSpanInfo -> FilePath -> IO [SrcSpanInfo]
81 | findMatches trav path = do
82 | sourceString <- unpack <$> readFile path
83 | let extensions = extractExtensions sourceString
84 | mode = (configureParseMode extensions) { parseFilename = path }
85 | case parseFileContentsWithMode mode sourceString of
86 | ParseFailed srcLoc' err -> panic $ "ERROR at " <> show srcLoc' <> ": " <> show err
87 | ParseOk parsedMod -> return $ toListOf (cloneTraversal trav) parsedMod
88 |
89 | printPrettily :: Theme -> SrcSpanInfo -> IO () -- TODO: don't read the file each time
90 | printPrettily theme spanInfo = putColorFrom theme span =<< readFile (srcSpanFilename span)
91 | where
92 | span = spanInfo ^. srcSpanInfoL
93 |
94 | srcSpanInfoL :: Lens' SrcSpanInfo SrcSpan
95 | srcSpanInfoL = lens srcInfoSpan $ \ssi sis -> ssi { srcInfoSpan = sis }
96 |
97 | putColorFrom :: Theme -> SrcSpan -> Text -> IO ()
98 | putColorFrom theme span src = do
99 | mapM_ putStr
100 | . chunksToByteStrings toByteStringsColors256
101 | . chunkify
102 | . L.take (srcSpanEndLine span - srcSpanStartLine span + 1)
103 | . L.drop (srcSpanStartLine span - 1)
104 | . T.lines
105 | $ src
106 | putStr ("\n" :: ByteString)
107 | where
108 | chunkify :: [Text] -> [Chunk Text]
109 | chunkify = \case
110 | [] -> panic "how can we have no lines?"
111 | [x] -> [pre, val, suf]
112 | where
113 | pre :: Chunk Text
114 | pre = (chunk . T.take startc $ x)
115 |
116 | val :: Chunk Text
117 | val = (chunk . T.take n . T.drop startc $ x)
118 | & match theme
119 | where
120 | n = endc - startc
121 |
122 | suf :: Chunk Text
123 | suf = (chunk . T.drop endc $ x)
124 |
125 | startc = srcSpanStartColumn span - 1
126 | endc = srcSpanEndColumn span - 1
127 |
128 | xs@(x:_) -> firstLine ++ middleLines ++ lastLine
129 | where
130 | firstLine = [pre, firstVal]
131 |
132 | middleLines -- TODO: we need 'total' concentwation
133 | | L.length xs < 2 = panic "unpossible!"
134 | | L.length xs == 2 = []
135 | | otherwise = case initMay xs of
136 | Nothing -> panic "initMay failing - unpossible!"
137 | Just xs' -> fmap chunk . L.drop 1 $ xs'
138 |
139 | lastLine = [lastVal, post]
140 |
141 | pre = chunk $ T.take (srcSpanStartColumn span) x
142 | firstVal = chunk $ T.drop (srcSpanStartColumn span) x
143 | lastVal = chunk $ T.take (srcSpanEndColumn span) lx
144 | post = chunk $ T.drop (srcSpanEndColumn span) lx
145 |
146 | lx = fromMaybe (panic "unpossible!") . lastMay $ xs
147 |
148 | replace :: Config -> Text -> IO ()
149 | replace Config{..} _mapFnSrc = panic "legacyReplace not implemented yet"
150 |
--------------------------------------------------------------------------------
/src/Refactorio/Main.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 | {-# LANGUAGE OverloadedStrings #-}
3 |
4 | module Refactorio.Main ( main ) where
5 |
6 | import Refactorio.Prelude as P hiding ( (<>) )
7 |
8 | import qualified Data.List.NonEmpty as NE
9 | import qualified Data.Set as Set
10 | import qualified Data.Text as Text
11 | import Options.Applicative hiding ( prefs )
12 | import Refactorio.Engine ( process )
13 | import Refactorio.FilenameFilter
14 | import Refactorio.SpecialMode
15 | import Refactorio.Types
16 | import X.Rainbow
17 |
18 | main :: IO ()
19 | main = void $ customExecParser prefs opts >>= process . wrapSrc
20 | where
21 | prefs = defaultPrefs
22 | { prefShowHelpOnError = True
23 | , prefShowHelpOnEmpty = True
24 | }
25 |
26 | opts = info (parser <**> helper) $ fullDesc
27 | <> header "Refactorio - Optical Refactoring Tool"
28 |
29 | wrapSrc :: Config -> Config
30 | wrapSrc = identity
31 | -- wrapSrc config@Config{..} = case specialModeMay of
32 | -- Nothing -> config
33 | -- Just m -> case m of
34 | -- Haskell -> config { expr = expr & upon unExpression %~ pre "H.hs" }
35 | -- Json -> config -- already lens-aeson'able
36 | -- Yaml -> config { expr = expr & upon unExpression %~ pre "H.yaml" }
37 | -- where
38 | -- pre x y = x <> " . (" <> y <> ")"
39 |
40 | parser :: Parser Config
41 | parser = prefixConfigParser
42 | where
43 | prefixConfigParser :: Parser Config
44 | prefixConfigParser = reorder
45 | <$> monadicParser
46 | <*> expressionParser
47 | <*> targetParser
48 | <*> filenameFilterSetParser
49 | <*> optional preludeParser
50 | <*> updateModeParser
51 | <*> specialModeParser
52 |
53 | -- So Optparse Applicative will generate the options in our preferred order
54 | reorder mo ex ta ff pr um sp = Config ff ex mo pr sp um ta
55 |
56 | monadicParser :: Parser Bool
57 | monadicParser = switch
58 | ( long "io"
59 | <> help "Add IO to expr type ('ByteString -> IO ByteString')"
60 | )
61 |
62 | expressionParser :: Parser Expression
63 | expressionParser = Expression . Text.pack <$> argument str
64 | ( metavar "EXPR"
65 | <> help "A Haskell expression of type 'ByteString -> ByteString'"
66 | )
67 |
68 | targetParser :: Parser (NonEmpty Target)
69 | targetParser =
70 | ( NE.fromList
71 | <$> some ( Target <$> strOption
72 | ( long "target"
73 | <> short 't'
74 | <> metavar "TARGET"
75 | <> help "One or more files/directories to traverse (defaults to stdin, use '-' to force stdin)"
76 | )
77 | )
78 | ) <|> (pure . pure) defaultTarget
79 | where
80 | defaultTarget = Target "-"
81 |
82 | filenameFilterSetParser :: Parser (Set FilenameFilter)
83 | filenameFilterSetParser = Set.fromList . map (FilenameFilter . Text.pack) <$> many
84 | ( strOption ( long "glob"
85 | <> short 'g'
86 | <> metavar "GLOB"
87 | <> help "Glob matches to include (eg '*.ini', 'f??b?r.c')"
88 | ) )
89 |
90 | preludeParser :: Parser FilePath
91 | preludeParser = strOption
92 | ( long "prelude"
93 | <> help "Use a specific Prelude module"
94 | <> metavar "MODULE"
95 | )
96 |
97 | updateModeParser :: Parser UpdateMode
98 | updateModeParser =
99 | AskMode <$ switch ( long "ask"
100 | <> short 'a'
101 | <> help "Ask before changing files (default)"
102 | )
103 | <|> PreviewMode <$ switch ( long "preview"
104 | <> short 'p'
105 | <> help "Only show the changes that would be made"
106 | )
107 | <|> ModifyMode <$ switch ( long "modify"
108 | <> short 'm'
109 | <> help "Make the changes and summarize changed filenames"
110 | )
111 | -- <|> ReplaceMode <$ switch ( long "replace"
112 | -- <> short 'r'
113 | -- <> help "Activate alternate replace mode (Haskell mode only currently)"
114 | -- )
115 | <|> ReviewMode <$ switch ( long "review"
116 | <> help "Make the changes and show details of changes"
117 | )
118 | <|> SearchMode <$ switch ( long "search"
119 | <> short 's'
120 | <> help "Activate alternate search mode (Haskell mode only right now)"
121 | )
122 | <|> pure AskMode
123 |
124 | specialModeParser :: Parser (Maybe SpecialMode)
125 | specialModeParser =
126 | langSwitch Haskell ( long "haskell"
127 | <> long "hs"
128 | <> help "Include .hs files and make Haskell ops available"
129 | )
130 | <|> langSwitch Html ( long "html"
131 | <> help "Include .htm(l) files and make XML ops available"
132 | )
133 | <|> langSwitch JavaScript ( long "javascript"
134 | <> long "js"
135 | <> help "Include .js files and make JavaScript ops available"
136 | )
137 | <|> langSwitch C ( long "c"
138 | <> help "Include .c files and make C ops available"
139 | )
140 | <|> langSwitch Json ( long "json"
141 | <> help "Include .json files and make JSON ops available"
142 | )
143 | <|> langSwitch Xml ( long "xml"
144 | <> help "Include .xml files and make XML ops available"
145 | )
146 | <|> langSwitch Yaml ( long "yaml"
147 | <> help "Include .y(a)ml files and make YAML ops available"
148 | )
149 | where
150 | langSwitch m = (mmap m <$>) . switch
151 |
152 | mmap :: SpecialMode -> Bool -> Maybe SpecialMode
153 | mmap sm True = Just sm
154 | mmap _ False = Nothing
155 |
--------------------------------------------------------------------------------
/src/Refactorio/Prelude.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 | {-# LANGUAGE OverloadedStrings #-}
3 |
4 | module Refactorio.Prelude
5 | ( module Exports
6 | , Container(..)
7 | , Ended(..)
8 | , Started(..)
9 | , getLn
10 | , nl
11 | , putLn
12 | , sleep
13 | ) where
14 |
15 | import Control.Arrow as Exports ( (&&&) )
16 | import Control.Lens as Exports ( (%~)
17 | , (.~)
18 | , (^.)
19 | , ATraversal'
20 | , Iso'
21 | , Lens'
22 | , cloneTraversal
23 | , each
24 | , from
25 | , iso
26 | , lens
27 | , makeClassy
28 | , partsOf
29 | , toListOf
30 | , view
31 | )
32 | import Data.Data as Exports ( Data )
33 | import Data.Data.Lens as Exports ( upon )
34 | import Data.Default as Exports
35 | import Data.List as List
36 | import Data.String as Exports ( String )
37 | import Data.Text as Exports ( unpack )
38 | import Data.Text as Text ( isPrefixOf )
39 | import qualified Data.Text as Text
40 | import Protolude as Exports hiding ( from )
41 |
42 | class Container a where
43 | contains :: a -> a -> Bool
44 |
45 | class Ended a where
46 | endsWith :: a -> a -> Bool
47 |
48 | class Started a where
49 | startsWith :: a -> a -> Bool
50 |
51 | instance Eq a => Container [a] where
52 | contains = flip List.isInfixOf
53 |
54 | instance Eq a => Ended [a] where
55 | endsWith = flip List.isSuffixOf
56 |
57 | instance Eq a => Started [a] where
58 | startsWith = flip List.isPrefixOf
59 |
60 | instance Started Text where
61 | startsWith = flip Text.isPrefixOf
62 |
63 | instance Ended Text where
64 | endsWith = flip Text.isSuffixOf
65 |
66 | getLn :: MonadIO m => m Text
67 | getLn = liftIO getLine
68 |
69 | putLn :: MonadIO m => Text -> m ()
70 | putLn = putStrLn
71 |
72 | nl :: MonadIO m => m ()
73 | nl = putLn ""
74 |
75 | sleep :: MonadIO m => Float -> m ()
76 | sleep n = liftIO . threadDelay . round $ n * 1000 * 1000
77 |
--------------------------------------------------------------------------------
/src/Refactorio/Prelude/Basic.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module Refactorio.Prelude.Basic ( module Exports ) where
4 |
5 | import Control.Lens as Exports
6 | import Data.Data.Lens as Exports
7 | import Numeric.Lens as Exports
8 | import Protolude as Exports hiding ( (<&>)
9 | , (<.>)
10 | , Strict
11 | , from
12 | , to
13 | , uncons
14 | , unsnoc
15 | )
16 | import Refactorio.Conversions as Exports
17 | import Text.Regex.Lens as Exports
18 | import Text.Regex.PCRE as Exports ( Regex )
19 | import Text.Regex.Quote as Exports
20 | import Text.Show.Number as Exports
21 |
22 |
--------------------------------------------------------------------------------
/src/Refactorio/Prelude/C.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module Refactorio.Prelude.C ( module Exports ) where
4 |
5 | import Refactorio.Prelude.Basic as Exports
6 |
7 | import Language.C.Optics as Exports
8 |
9 |
--------------------------------------------------------------------------------
/src/Refactorio/Prelude/Haskell.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE MultiParamTypeClasses #-}
2 | {-# LANGUAGE NoImplicitPrelude #-}
3 |
4 | module Refactorio.Prelude.Haskell
5 | ( module Exports
6 | , end
7 | , target
8 | ) where
9 |
10 | import Refactorio.Prelude.Basic as Exports hiding ( Alt
11 | , Context
12 | , Fixity
13 | , List
14 | , SrcLoc
15 | , _Cons
16 | , mod
17 | , op
18 | , sym
19 | )
20 |
21 | import Language.Haskell.Exts as Exports
22 | import X.Language.Haskell.Exts.Prisms as Exports
23 |
24 | end :: Field1 s t a b => Lens s t a b
25 | end = _1
26 |
27 | -- _Hask Prism is exported from X.Language.Haskell.Exts.Prisms
28 |
29 | target :: (Functor f, Field2 s t a b) => (a -> f b) -> s -> f t
30 | target = _2
31 |
--------------------------------------------------------------------------------
/src/Refactorio/Prelude/Html.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module Refactorio.Prelude.Html
4 | ( module Exports
5 | , _Html
6 | ) where
7 |
8 | import Refactorio.Prelude.Basic as Exports hiding ( children
9 | , element
10 | , elements
11 | )
12 |
13 | import Text.XML
14 | import Text.XML.Lens as Exports
15 |
16 | _Html :: Prism' ByteString Document
17 | _Html = prism g s
18 | where
19 | g :: Document -> ByteString
20 | g = view convert . renderLBS renderSettings
21 |
22 | s :: ByteString -> Either ByteString Document
23 | s = f . view (convertTo (a :: LByteString))
24 | where
25 | f :: LByteString -> Either ByteString Document
26 | f = first show . parseLBS parseSettings
27 |
28 | renderSettings :: RenderSettings
29 | renderSettings = def
30 |
31 | parseSettings :: ParseSettings
32 | parseSettings = def
33 |
--------------------------------------------------------------------------------
/src/Refactorio/Prelude/JavaScript.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module Refactorio.Prelude.JavaScript ( module Exports ) where
4 |
5 | import Refactorio.Prelude.Basic as Exports
6 |
7 | import Language.JavaScript.Optics as Exports
8 |
9 |
--------------------------------------------------------------------------------
/src/Refactorio/Prelude/Json.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module Refactorio.Prelude.Json ( module Exports ) where
4 |
5 | import Refactorio.Prelude.Basic as Exports
6 |
7 | import Data.Aeson.Lens as Exports
8 |
9 |
--------------------------------------------------------------------------------
/src/Refactorio/Prelude/Xml.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module Refactorio.Prelude.Xml
4 | ( module Exports
5 | , xmlL
6 | ) where
7 |
8 | import Refactorio.Prelude.Basic as Exports hiding ( children
9 | , element
10 | , elements
11 | )
12 |
13 | import Data.String.Conv ( convS )
14 | import Text.Xml.Lens as Exports
15 |
16 | xmlL :: Lens' ByteString LByteString
17 | xmlL = convS
18 |
--------------------------------------------------------------------------------
/src/Refactorio/Prelude/Yaml.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module Refactorio.Prelude.Yaml ( module Exports ) where
4 |
5 | import Refactorio.Prelude.Basic as Exports
6 |
7 | import Data.Aeson.Lens as Exports
8 | import Refactorio.Helpers as Exports ( yaml )
9 |
10 |
--------------------------------------------------------------------------------
/src/Refactorio/SpecialMode.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE DeriveDataTypeable #-}
2 | {-# LANGUAGE NoImplicitPrelude #-}
3 |
4 | module Refactorio.SpecialMode where
5 |
6 | import Refactorio.Prelude
7 |
8 |
9 | data SpecialMode
10 | = C
11 | | Haskell
12 | | Html
13 | | JavaScript
14 | | Json
15 | | Xml
16 | | Yaml
17 | deriving (Data, Eq, Ord, Read, Show, Typeable)
18 |
--------------------------------------------------------------------------------
/src/Refactorio/Theme.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module Refactorio.Theme where
4 |
5 | import X.Rainbow
6 |
7 | data Theme = Theme
8 | { errorColor :: StyleFn
9 | , filename :: StyleFn
10 | , match :: StyleFn
11 | , searchHdr :: StyleFn
12 | , searchValue :: StyleFn
13 | , withinHdr :: StyleFn
14 | , withinValue :: StyleFn
15 | }
16 |
17 | type StyleFn = Chunk' -> Chunk'
18 |
19 | defaultTheme :: Theme
20 | defaultTheme = Theme
21 | { errorColor = \c -> c & fore red
22 | , filename = \c -> c & fore green
23 | , match = \c -> c & fore yellow & inverse
24 | , searchHdr = \c -> c & fore blue
25 | , searchValue = \c -> c & fore blue & inverse & bold
26 | , withinHdr = \c -> c & fore blue
27 | , withinValue = \c -> c & fore blue & bold
28 | }
29 |
--------------------------------------------------------------------------------
/src/Refactorio/Types.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE DeriveDataTypeable #-}
2 | {-# LANGUAGE InstanceSigs #-}
3 | {-# LANGUAGE NoImplicitPrelude #-}
4 |
5 | module Refactorio.Types where
6 |
7 | import Refactorio.Prelude
8 |
9 | import Refactorio.FilenameFilter
10 | import Refactorio.SpecialMode
11 |
12 | data ChangeChoice = AcceptChange | RejectChange | QuitChanges
13 | deriving (Data, Eq, Ord, Read, Show, Typeable)
14 |
15 | data Config = Config
16 | { filenameFilters :: Set FilenameFilter
17 | , expr :: Expression
18 | , monadic :: Bool
19 | , preludeModuleMay :: Maybe String
20 | , specialModeMay :: Maybe SpecialMode
21 | , updateMode :: UpdateMode
22 | , targets :: NonEmpty Target
23 | } deriving (Data, Eq, Ord, Read, Show)
24 |
25 | newtype Expression = Expression { unExpression :: Text }
26 | deriving (Data, Eq, Ord, Read, Show)
27 |
28 | data MappingFn
29 | = MapFn (ByteString -> ByteString)
30 | | MapMFn (ByteString -> IO ByteString)
31 |
32 | data Result = Result
33 | deriving (Data, Eq, Ord, Read, Show)
34 |
35 | newtype Target = Target { unTarget :: FilePath }
36 | deriving (Data, Eq, Ord, Read, Show)
37 |
38 | data UpdateMode
39 | = AskMode
40 | | ModifyMode
41 | | Nope
42 | | PreviewMode
43 | -- | ReplaceMode Text
44 | | ReviewMode
45 | | SearchMode
46 | deriving (Data, Eq, Ord, Read, Show)
47 |
48 | data WriteChanges = Yes | No | Ask
49 | deriving (Data, Eq, Ord, Read, Show)
50 |
--------------------------------------------------------------------------------
/src/X/Language/Haskell/Exts.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 | {-# LANGUAGE OverloadedStrings #-}
3 |
4 | module X.Language.Haskell.Exts
5 | ( module Exports
6 | , hs
7 | ) where
8 |
9 | import Refactorio.Prelude hiding ( get )
10 |
11 | import Data.ByteString.Char8 as Char8
12 | import Language.Haskell.Exts as Exports
13 |
14 | hs :: Iso' ByteString (Module SrcSpanInfo)
15 | hs = iso get set
16 | where
17 | get :: ByteString -> Module SrcSpanInfo
18 | get bs = case parseFileContentsWithMode mode' . Char8.unpack $ bs of
19 | ParseOk m -> m
20 | other -> panic . show $ other
21 |
22 | set :: Module SrcSpanInfo -> ByteString
23 | set = panic "hs set' undefined"
24 |
25 | mode' :: ParseMode
26 | mode' = ParseMode "refactorio-live" Haskell2010 defaultExtensions
27 | False False Nothing False
28 | where
29 | defaultExtensions = []
30 |
--------------------------------------------------------------------------------
/src/X/Language/Haskell/Exts/CabalUtils.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 | {-# LANGUAGE OverloadedStrings #-}
3 |
4 | module X.Language.Haskell.Exts.CabalUtils ( findExtensions ) where
5 |
6 | import Control.Lens ( view )
7 | import Data.Set ( fromList )
8 | import Distribution.PackageDescription.Parse ( ParseResult( ParseFailed
9 | , ParseOk
10 | )
11 | , parseGenericPackageDescription
12 | )
13 | import Distribution.Types.BuildInfo ( defaultExtensions
14 | , otherExtensions
15 | )
16 | import Distribution.Types.GenericPackageDescription ( packageDescription )
17 | import Distribution.Types.PackageDescription ( allBuildInfo )
18 | import Language.Haskell.Extension ( Extension )
19 | import Protolude
20 | import Refactorio.Conversions ( convert )
21 |
22 | -- TODO: wire up to read cabal files from targets when available
23 | -- TODO: test to confirm this is equivalent to the more complicated longboye version
24 | findExtensions :: ByteString -> [Extension]
25 | findExtensions bs = case parseGenericPackageDescription . view convert $ bs of
26 | ParseFailed e -> panic $ "findExtensions failed: " <> show e
27 | ParseOk _warnings packDesc -> allExts
28 | where
29 | buildInfos = allBuildInfo . packageDescription $ packDesc
30 | allExts = toList . fromList $ dexts ++ oexts
31 | dexts = join $ map defaultExtensions buildInfos
32 | oexts = join $ map otherExtensions buildInfos
33 |
--------------------------------------------------------------------------------
/src/X/Language/Haskell/Exts/Prisms.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE LambdaCase #-}
2 | {-# LANGUAGE NoImplicitPrelude #-}
3 | {-# LANGUAGE OverloadedStrings #-}
4 | {-# LANGUAGE RankNTypes #-}
5 |
6 | module X.Language.Haskell.Exts.Prisms where
7 |
8 | import Refactorio.Prelude hiding ( Alt )
9 |
10 | import Control.Lens ( Iso'
11 | , Prism'
12 | , prism
13 | )
14 | import Data.ByteString.Char8 as Char8
15 | import Language.Haskell.Exts
16 | import qualified Language.Haskell.Exts.Prisms as X
17 | import Refactorio.Conversions ( convert )
18 | import X.Language.Haskell.Exts.Prisms.Types as Exports
19 |
20 | -- TODO: should change it to be a prism from (FilePath, ByteString) so we can
21 | -- pass the filepath to parseMode to get meaningful error messags.
22 | -- ... will have to modify the driver to pass the path and modify
23 | -- everything else to expect it.
24 | _Hask :: Prism' ByteString (Module SrcSpanInfo, [Comment])
25 | _Hask = prism get_ set_
26 | where
27 | get_ :: (Module SrcSpanInfo, [Comment]) -> ByteString
28 | get_ = Char8.pack . uncurry exactPrint
29 |
30 | set_ :: ByteString -> Either ByteString (Module SrcSpanInfo, [Comment])
31 | set_ bs = case parseWithComments parseMode . Char8.unpack $ bs of
32 | ParseOk modWithComments -> Right modWithComments
33 | ParseFailed srcLoc' msg -> panic . show $ (msg,srcLoc',bs)
34 | -- ParseFailed _ _ -> Left bs
35 | where
36 | parseMode = (configureParseMode foundExtensions) { parseFilename = path}
37 |
38 | foundExtensions :: [Extension]
39 | foundExtensions = extractExtensions . view convert $ bs
40 |
41 | path = "_Hask Prism contents"
42 |
43 | extractExtensions :: String -> [Extension]
44 | extractExtensions = (EnableExtension MultiParamTypeClasses:) . unpackExts . readExtensions
45 | -- We append MultiParamTypeClasses because haskell-src-exts seems to need it
46 | -- sometimes even when nothing else does, and it should never hurt anything.
47 | where
48 | unpackExts :: Maybe (Maybe Language, [Extension]) -> [Extension]
49 | unpackExts = \case
50 | Nothing -> panic "could not parse language pragmas"
51 | Just (_, exts) -> exts
52 |
53 | -- TODO: unhardcode
54 | configureParseMode :: [Extension] -> ParseMode
55 | configureParseMode foundExtensions = defaultParseMode
56 | { baseLanguage = Haskell2010
57 | , ignoreLanguagePragmas = False
58 | , extensions = configuredExtensions
59 | }
60 | where
61 | configuredExtensions = extensions defaultParseMode ++ foundExtensions
62 |
63 | -- TODO: Surely there's a way to avoid the 'ambiguous l' problem without
64 | -- duplicating all this code?
65 | -- ================================================================================
66 |
67 | _ParenFormula :: Prism'
68 | (BooleanFormula SrcSpanInfo)
69 | (SrcSpanInfo, BooleanFormula SrcSpanInfo)
70 | _ParenFormula = X._ParenFormula
71 |
72 | _OrFormula :: Prism' (BooleanFormula SrcSpanInfo) (SrcSpanInfo, [BooleanFormula SrcSpanInfo])
73 | _OrFormula = X._OrFormula
74 |
75 | _AndFormula :: Prism' (BooleanFormula SrcSpanInfo) (SrcSpanInfo, [BooleanFormula SrcSpanInfo])
76 | _AndFormula = X._AndFormula
77 |
78 | _VarFormula :: Prism' (BooleanFormula SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
79 | _VarFormula = X._VarFormula
80 |
81 | _ModuleAnn :: Prism' (Annotation SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
82 | _ModuleAnn = X._ModuleAnn
83 |
84 | _TypeAnn :: Prism' (Annotation SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, Exp SrcSpanInfo)
85 | _TypeAnn = X._TypeAnn
86 |
87 | _Ann :: Prism' (Annotation SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, Exp SrcSpanInfo)
88 | _Ann = X._Ann
89 |
90 | _ActiveUntil :: Prism' (Activation SrcSpanInfo) (SrcSpanInfo, Int)
91 | _ActiveUntil = X._ActiveUntil
92 |
93 | _ActiveFrom :: Prism' (Activation SrcSpanInfo) (SrcSpanInfo, Int)
94 | _ActiveFrom = X._ActiveFrom
95 |
96 | _TypedRuleVar :: Prism' (RuleVar SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, Type SrcSpanInfo)
97 | _TypedRuleVar = X._TypedRuleVar
98 |
99 | _RuleVar :: Prism' (RuleVar SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
100 | _RuleVar = X._RuleVar
101 |
102 | _Overlap :: Prism' (Overlap SrcSpanInfo) SrcSpanInfo
103 | _Overlap = X._Overlap
104 |
105 | _NoOverlap :: Prism' (Overlap SrcSpanInfo) SrcSpanInfo
106 | _NoOverlap = X._NoOverlap
107 |
108 | _UnknownTool :: Prism' Tool String
109 | _UnknownTool = X._UnknownTool
110 |
111 | _HADDOCK :: Prism' Tool ()
112 | _HADDOCK = X._HADDOCK
113 |
114 | _YHC :: Prism' Tool ()
115 | _YHC = X._YHC
116 |
117 | _NHC98 :: Prism' Tool ()
118 | _NHC98 = X._NHC98
119 |
120 | _HUGS :: Prism' Tool ()
121 | _HUGS = X._HUGS
122 |
123 | _GHC :: Prism' Tool ()
124 | _GHC = X._GHC
125 |
126 | _AnnModulePragma :: Prism' (ModulePragma SrcSpanInfo) (SrcSpanInfo, Annotation SrcSpanInfo)
127 | _AnnModulePragma = X._AnnModulePragma
128 |
129 | _OptionsPragma :: Prism' (ModulePragma SrcSpanInfo) (SrcSpanInfo, Maybe Tool, String)
130 | _OptionsPragma = X._OptionsPragma
131 |
132 | _LanguagePragma :: Prism' (ModulePragma SrcSpanInfo) (SrcSpanInfo, [Name SrcSpanInfo])
133 | _LanguagePragma = X._LanguagePragma
134 |
135 | _CApi :: Prism' (CallConv SrcSpanInfo) SrcSpanInfo
136 | _CApi = X._CApi
137 |
138 | _JavaScript :: Prism' (CallConv SrcSpanInfo) SrcSpanInfo
139 | _JavaScript = X._JavaScript
140 |
141 | _Js :: Prism' (CallConv SrcSpanInfo) SrcSpanInfo
142 | _Js = X._Js
143 |
144 | _Jvm :: Prism' (CallConv SrcSpanInfo) SrcSpanInfo
145 | _Jvm = X._Jvm
146 |
147 | _DotNet :: Prism' (CallConv SrcSpanInfo) SrcSpanInfo
148 | _DotNet = X._DotNet
149 |
150 | _CPlusPlus :: Prism' (CallConv SrcSpanInfo) SrcSpanInfo
151 | _CPlusPlus = X._CPlusPlus
152 |
153 | _CCall :: Prism' (CallConv SrcSpanInfo) SrcSpanInfo
154 | _CCall = X._CCall
155 |
156 | _StdCall :: Prism' (CallConv SrcSpanInfo) SrcSpanInfo
157 | _StdCall = X._StdCall
158 |
159 | _PlayInterruptible :: Prism' (Safety SrcSpanInfo) SrcSpanInfo
160 | _PlayInterruptible = X._PlayInterruptible
161 |
162 | _PlaySafe :: Prism' (Safety SrcSpanInfo) (SrcSpanInfo, Bool)
163 | _PlaySafe = X._PlaySafe
164 |
165 | _PlayRisky :: Prism' (Safety SrcSpanInfo) SrcSpanInfo
166 | _PlayRisky = X._PlayRisky
167 |
168 | _ParenSplice :: Prism' (Splice SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
169 | _ParenSplice = X._ParenSplice
170 |
171 | _IdSplice :: Prism' (Splice SrcSpanInfo) (SrcSpanInfo, String)
172 | _IdSplice = X._IdSplice
173 |
174 | _DeclBracket :: Prism' (Bracket SrcSpanInfo) (SrcSpanInfo, [Decl SrcSpanInfo])
175 | _DeclBracket = X._DeclBracket
176 |
177 | _TypeBracket :: Prism' (Bracket SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo)
178 | _TypeBracket = X._TypeBracket
179 |
180 | _PatBracket :: Prism' (Bracket SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo)
181 | _PatBracket = X._PatBracket
182 |
183 | _ExpBracket :: Prism' (Bracket SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
184 | _ExpBracket = X._ExpBracket
185 |
186 | _RoleWildcard :: Prism' (Role SrcSpanInfo) SrcSpanInfo
187 | _RoleWildcard = X._RoleWildcard
188 |
189 | _Phantom :: Prism' (Role SrcSpanInfo) SrcSpanInfo
190 | _Phantom = X._Phantom
191 |
192 | _Representational :: Prism' (Role SrcSpanInfo) SrcSpanInfo
193 | _Representational = X._Representational
194 |
195 | _Nominal :: Prism' (Role SrcSpanInfo) SrcSpanInfo
196 | _Nominal = X._Nominal
197 |
198 | _XDomName :: Prism' (XName SrcSpanInfo) (SrcSpanInfo, String, String)
199 | _XDomName = X._XDomName
200 |
201 | _XName :: Prism' (XName SrcSpanInfo) (SrcSpanInfo, String)
202 | _XName = X._XName
203 |
204 | _IPLin :: Prism' (IPName SrcSpanInfo) (SrcSpanInfo, String)
205 | _IPLin = X._IPLin
206 |
207 | _IPDup :: Prism' (IPName SrcSpanInfo) (SrcSpanInfo, String)
208 | _IPDup = X._IPDup
209 |
210 | _ConName :: Prism' (CName SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
211 | _ConName = X._ConName
212 |
213 | _VarName :: Prism' (CName SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
214 | _VarName = X._VarName
215 |
216 | _UnboxedSingleCon :: Prism' (SpecialCon SrcSpanInfo) SrcSpanInfo
217 | _UnboxedSingleCon = X._UnboxedSingleCon
218 |
219 | _Cons :: Prism' (SpecialCon SrcSpanInfo) SrcSpanInfo
220 | _Cons = X._Cons
221 |
222 | _TupleCon :: Prism' (SpecialCon SrcSpanInfo) (SrcSpanInfo, Boxed, Int)
223 | _TupleCon = X._TupleCon
224 |
225 | _FunCon :: Prism' (SpecialCon SrcSpanInfo) SrcSpanInfo
226 | _FunCon = X._FunCon
227 |
228 | _ListCon :: Prism' (SpecialCon SrcSpanInfo) SrcSpanInfo
229 | _ListCon = X._ListCon
230 |
231 | _UnitCon :: Prism' (SpecialCon SrcSpanInfo) SrcSpanInfo
232 | _UnitCon = X._UnitCon
233 |
234 | _ConOp :: Prism' (Op SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
235 | _ConOp = X._ConOp
236 |
237 | _VarOp :: Prism' (Op SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
238 | _VarOp = X._VarOp
239 |
240 | _QConOp :: Prism' (QOp SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
241 | _QConOp = X._QConOp
242 |
243 | _QVarOp :: Prism' (QOp SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
244 | _QVarOp = X._QVarOp
245 |
246 | _Symbol :: Prism' (Name SrcSpanInfo) (SrcSpanInfo, String)
247 | _Symbol = X._Symbol
248 |
249 | _Ident :: Prism' (Name SrcSpanInfo) (SrcSpanInfo, String)
250 | _Ident = X._Ident
251 |
252 | _Special :: Prism' (QName SrcSpanInfo) (SrcSpanInfo, SpecialCon SrcSpanInfo)
253 | _Special = X._Special
254 |
255 | _UnQual :: Prism' (QName SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
256 | _UnQual = X._UnQual
257 |
258 | _Qual :: Prism' (QName SrcSpanInfo) (SrcSpanInfo, ModuleName SrcSpanInfo, Name SrcSpanInfo)
259 | _Qual = X._Qual
260 |
261 | _Negative :: Prism' (Sign SrcSpanInfo) SrcSpanInfo
262 | _Negative = X._Negative
263 |
264 | _Signless :: Prism' (Sign SrcSpanInfo) SrcSpanInfo
265 | _Signless = X._Signless
266 |
267 | _PrimString :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, String, String)
268 | _PrimString = X._PrimString
269 |
270 | _PrimChar :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, Char, String)
271 | _PrimChar = X._PrimChar
272 |
273 | _PrimDouble :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, Rational, String)
274 | _PrimDouble = X._PrimDouble
275 |
276 | _PrimFloat :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, Rational, String)
277 | _PrimFloat = X._PrimFloat
278 |
279 | _PrimWord :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, Integer, String)
280 | _PrimWord = X._PrimWord
281 |
282 | _PrimInt :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, Integer, String)
283 | _PrimInt = X._PrimInt
284 |
285 | _Frac :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, Rational, String)
286 | _Frac = X._Frac
287 |
288 | _Int :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, Integer, String)
289 | _Int = X._Int
290 |
291 | _String :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, String, String)
292 | _String = X._String
293 |
294 | _Char :: Prism' (Literal SrcSpanInfo) (SrcSpanInfo, Char, String)
295 | _Char = X._Char
296 |
297 | _RPOptG :: Prism' (RPatOp SrcSpanInfo) SrcSpanInfo
298 | _RPOptG = X._RPOptG
299 |
300 | _RPOpt :: Prism' (RPatOp SrcSpanInfo) SrcSpanInfo
301 | _RPOpt = X._RPOpt
302 |
303 | _RPPlusG :: Prism' (RPatOp SrcSpanInfo) SrcSpanInfo
304 | _RPPlusG = X._RPPlusG
305 |
306 | _RPPlus :: Prism' (RPatOp SrcSpanInfo) SrcSpanInfo
307 | _RPPlus = X._RPPlus
308 |
309 | _RPStarG :: Prism' (RPatOp SrcSpanInfo) SrcSpanInfo
310 | _RPStarG = X._RPStarG
311 |
312 | _RPStar :: Prism' (RPatOp SrcSpanInfo) SrcSpanInfo
313 | _RPStar = X._RPStar
314 |
315 | _RPPat :: Prism' (RPat SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo)
316 | _RPPat = X._RPPat
317 |
318 | _RPParen :: Prism' (RPat SrcSpanInfo) (SrcSpanInfo, RPat SrcSpanInfo)
319 | _RPParen = X._RPParen
320 |
321 | _RPAs :: Prism' (RPat SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, RPat SrcSpanInfo)
322 | _RPAs = X._RPAs
323 |
324 | _RPCAs :: Prism' (RPat SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, RPat SrcSpanInfo)
325 | _RPCAs = X._RPCAs
326 |
327 | _RPGuard :: Prism' (RPat SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo, [Stmt SrcSpanInfo])
328 | _RPGuard = X._RPGuard
329 |
330 | _RPSeq :: Prism' (RPat SrcSpanInfo) (SrcSpanInfo, [RPat SrcSpanInfo])
331 | _RPSeq = X._RPSeq
332 |
333 | _RPEither :: Prism' (RPat SrcSpanInfo) (SrcSpanInfo, RPat SrcSpanInfo, RPat SrcSpanInfo)
334 | _RPEither = X._RPEither
335 |
336 | _RPOp :: Prism' (RPat SrcSpanInfo) (SrcSpanInfo, RPat SrcSpanInfo, RPatOp SrcSpanInfo)
337 | _RPOp = X._RPOp
338 |
339 | _PFieldWildcard :: Prism' (PatField SrcSpanInfo) SrcSpanInfo
340 | _PFieldWildcard = X._PFieldWildcard
341 |
342 | _PFieldPun :: Prism' (PatField SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
343 | _PFieldPun = X._PFieldPun
344 |
345 | _PFieldPat :: Prism' (PatField SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo, Pat SrcSpanInfo)
346 | _PFieldPat = X._PFieldPat
347 |
348 | _PBangPat :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo)
349 | _PBangPat = X._PBangPat
350 |
351 | _PQuasiQuote :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, String, String)
352 | _PQuasiQuote = X._PQuasiQuote
353 |
354 | _PXRPats :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, [RPat SrcSpanInfo])
355 | _PXRPats = X._PXRPats
356 |
357 | _PXPatTag :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo)
358 | _PXPatTag = X._PXPatTag
359 |
360 | _PXPcdata :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, String)
361 | _PXPcdata = X._PXPcdata
362 |
363 | _PXETag :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, XName SrcSpanInfo, [PXAttr SrcSpanInfo], Maybe (Pat SrcSpanInfo))
364 | _PXETag = X._PXETag
365 |
366 | _PXTag :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, XName SrcSpanInfo, [PXAttr SrcSpanInfo], Maybe (Pat SrcSpanInfo), [Pat SrcSpanInfo])
367 | _PXTag = X._PXTag
368 |
369 | _PRPat :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, [RPat SrcSpanInfo])
370 | _PRPat = X._PRPat
371 |
372 | _PViewPat :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Pat SrcSpanInfo)
373 | _PViewPat = X._PViewPat
374 |
375 | _PatTypeSig :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo, Type SrcSpanInfo)
376 | _PatTypeSig = X._PatTypeSig
377 |
378 | _PIrrPat :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo)
379 | _PIrrPat = X._PIrrPat
380 |
381 | _PWildCard :: Prism' (Pat SrcSpanInfo) SrcSpanInfo
382 | _PWildCard = X._PWildCard
383 |
384 | _PAsPat :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, Pat SrcSpanInfo)
385 | _PAsPat = X._PAsPat
386 |
387 | _PRec :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo, [PatField SrcSpanInfo])
388 | _PRec = X._PRec
389 |
390 | _PParen :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo)
391 | _PParen = X._PParen
392 |
393 | _PList :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, [Pat SrcSpanInfo])
394 | _PList = X._PList
395 |
396 | _PTuple :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Boxed, [Pat SrcSpanInfo])
397 | _PTuple = X._PTuple
398 |
399 | _PApp :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo, [Pat SrcSpanInfo])
400 | _PApp = X._PApp
401 |
402 | _PInfixApp :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo, QName SrcSpanInfo, Pat SrcSpanInfo)
403 | _PInfixApp = X._PInfixApp
404 |
405 | _PNPlusK :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, Integer)
406 | _PNPlusK = X._PNPlusK
407 |
408 | _PLit :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Sign SrcSpanInfo, Literal SrcSpanInfo)
409 | _PLit = X._PLit
410 |
411 | _PVar :: Prism' (Pat SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
412 | _PVar = X._PVar
413 |
414 | _FieldWildcard :: Prism' (FieldUpdate SrcSpanInfo) SrcSpanInfo
415 | _FieldWildcard = X._FieldWildcard
416 |
417 | _FieldPun :: Prism' (FieldUpdate SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
418 | _FieldPun = X._FieldPun
419 |
420 | _FieldUpdate :: Prism' (FieldUpdate SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo, Exp SrcSpanInfo)
421 | _FieldUpdate = X._FieldUpdate
422 |
423 | _GroupByUsing :: Prism' (QualStmt SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
424 | _GroupByUsing = X._GroupByUsing
425 |
426 | _GroupUsing :: Prism' (QualStmt SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
427 | _GroupUsing = X._GroupUsing
428 |
429 | _GroupBy :: Prism' (QualStmt SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
430 | _GroupBy = X._GroupBy
431 |
432 | _ThenBy :: Prism' (QualStmt SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
433 | _ThenBy = X._ThenBy
434 |
435 | _ThenTrans :: Prism' (QualStmt SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
436 | _ThenTrans = X._ThenTrans
437 |
438 | _QualStmt :: Prism' (QualStmt SrcSpanInfo) (SrcSpanInfo, Stmt SrcSpanInfo)
439 | _QualStmt = X._QualStmt
440 |
441 | _RecStmt :: Prism' (Stmt SrcSpanInfo) (SrcSpanInfo, [Stmt SrcSpanInfo])
442 | _RecStmt = X._RecStmt
443 |
444 | _LetStmt :: Prism' (Stmt SrcSpanInfo) (SrcSpanInfo, Binds SrcSpanInfo)
445 | _LetStmt = X._LetStmt
446 |
447 | _Qualifier :: Prism' (Stmt SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
448 | _Qualifier = X._Qualifier
449 |
450 | _Generator :: Prism' (Stmt SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo, Exp SrcSpanInfo)
451 | _Generator = X._Generator
452 |
453 | _ExprHole :: Prism' (Exp SrcSpanInfo) SrcSpanInfo
454 | _ExprHole = X._ExprHole
455 |
456 | _LCase :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, [Alt SrcSpanInfo])
457 | _LCase = X._LCase
458 |
459 | _RightArrHighApp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
460 | _RightArrHighApp = X._RightArrHighApp
461 |
462 | _LeftArrHighApp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
463 | _LeftArrHighApp = X._LeftArrHighApp
464 |
465 | _RightArrApp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
466 | _RightArrApp = X._RightArrApp
467 |
468 | _LeftArrApp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
469 | _LeftArrApp = X._LeftArrApp
470 |
471 | _Proc :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo, Exp SrcSpanInfo)
472 | _Proc = X._Proc
473 |
474 | _GenPragma :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, String, (Int, Int), (Int, Int), Exp SrcSpanInfo)
475 | _GenPragma = X._GenPragma
476 |
477 | _SCCPragma :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, String, Exp SrcSpanInfo)
478 | _SCCPragma = X._SCCPragma
479 |
480 | _CorePragma :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, String, Exp SrcSpanInfo)
481 | _CorePragma = X._CorePragma
482 |
483 | _XChildTag :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, [Exp SrcSpanInfo])
484 | _XChildTag = X._XChildTag
485 |
486 | _XExpTag :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
487 | _XExpTag = X._XExpTag
488 |
489 | _XPcdata :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, String)
490 | _XPcdata = X._XPcdata
491 |
492 | _XETag :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, XName SrcSpanInfo, [XAttr SrcSpanInfo], Maybe (Exp SrcSpanInfo))
493 | _XETag = X._XETag
494 |
495 | _XTag :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, XName SrcSpanInfo, [XAttr SrcSpanInfo], Maybe (Exp SrcSpanInfo), [Exp SrcSpanInfo])
496 | _XTag = X._XTag
497 |
498 | _TypeApp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo)
499 | _TypeApp = X._TypeApp
500 |
501 | _QuasiQuote :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, String, String)
502 | _QuasiQuote = X._QuasiQuote
503 |
504 | _SpliceExp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Splice SrcSpanInfo)
505 | _SpliceExp = X._SpliceExp
506 |
507 | _BracketExp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Bracket SrcSpanInfo)
508 | _BracketExp = X._BracketExp
509 |
510 | _TypQuote :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
511 | _TypQuote = X._TypQuote
512 |
513 | _VarQuote :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
514 | _VarQuote = X._VarQuote
515 |
516 | _ExpTypeSig :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Type SrcSpanInfo)
517 | _ExpTypeSig = X._ExpTypeSig
518 |
519 | _ParArrayComp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, [[QualStmt SrcSpanInfo]])
520 | _ParArrayComp = X._ParArrayComp
521 |
522 | _ParComp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, [[QualStmt SrcSpanInfo]])
523 | _ParComp = X._ParComp
524 |
525 | _ListComp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, [QualStmt SrcSpanInfo])
526 | _ListComp = X._ListComp
527 |
528 | _ParArrayFromThenTo :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
529 | _ParArrayFromThenTo = X._ParArrayFromThenTo
530 |
531 | _ParArrayFromTo :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
532 | _ParArrayFromTo = X._ParArrayFromTo
533 |
534 | _EnumFromThenTo :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
535 | _EnumFromThenTo = X._EnumFromThenTo
536 |
537 | _EnumFromThen :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
538 | _EnumFromThen = X._EnumFromThen
539 |
540 | _EnumFromTo :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
541 | _EnumFromTo = X._EnumFromTo
542 |
543 | _EnumFrom :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
544 | _EnumFrom = X._EnumFrom
545 |
546 | _RecUpdate :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, [FieldUpdate SrcSpanInfo])
547 | _RecUpdate = X._RecUpdate
548 |
549 | _RecConstr :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo, [FieldUpdate SrcSpanInfo])
550 | _RecConstr = X._RecConstr
551 |
552 | _RightSection :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, QOp SrcSpanInfo, Exp SrcSpanInfo)
553 | _RightSection = X._RightSection
554 |
555 | _LeftSection :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, QOp SrcSpanInfo)
556 | _LeftSection = X._LeftSection
557 |
558 | _Paren :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
559 | _Paren = X._Paren
560 |
561 | _ParArray :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, [Exp SrcSpanInfo])
562 | _ParArray = X._ParArray
563 |
564 | _List :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, [Exp SrcSpanInfo])
565 | _List = X._List
566 |
567 | _TupleSection :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Boxed, [Maybe (Exp SrcSpanInfo)])
568 | _TupleSection = X._TupleSection
569 |
570 | _Tuple :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Boxed, [Exp SrcSpanInfo])
571 | _Tuple = X._Tuple
572 |
573 | _MDo :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, [Stmt SrcSpanInfo])
574 | _MDo = X._MDo
575 |
576 | _Do :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, [Stmt SrcSpanInfo])
577 | _Do = X._Do
578 |
579 | _Case :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, [Alt SrcSpanInfo])
580 | _Case = X._Case
581 |
582 | _MultiIf :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, [GuardedRhs SrcSpanInfo])
583 | _MultiIf = X._MultiIf
584 |
585 | _If :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
586 | _If = X._If
587 |
588 | _Let :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Binds SrcSpanInfo, Exp SrcSpanInfo)
589 | _Let = X._Let
590 |
591 | _Lambda :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, [Pat SrcSpanInfo], Exp SrcSpanInfo)
592 | _Lambda = X._Lambda
593 |
594 | _NegApp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
595 | _NegApp = X._NegApp
596 |
597 | _App :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, Exp SrcSpanInfo)
598 | _App = X._App
599 |
600 | _InfixApp :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo, QOp SrcSpanInfo, Exp SrcSpanInfo)
601 | _InfixApp = X._InfixApp
602 |
603 | _Lit :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, Literal SrcSpanInfo)
604 | _Lit = X._Lit
605 |
606 | _Con :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
607 | _Con = X._Con
608 |
609 | _IPVar :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, IPName SrcSpanInfo)
610 | _IPVar = X._IPVar
611 |
612 | _OverloadedLabel :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, String)
613 | _OverloadedLabel = X._OverloadedLabel
614 |
615 | _Var :: Prism' (Exp SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
616 | _Var = X._Var
617 |
618 | _PromotedUnit :: Prism' (Promoted SrcSpanInfo) SrcSpanInfo
619 | _PromotedUnit = X._PromotedUnit
620 |
621 | _PromotedTuple :: Prism' (Promoted SrcSpanInfo) (SrcSpanInfo, [Type SrcSpanInfo])
622 | _PromotedTuple = X._PromotedTuple
623 |
624 | _PromotedList :: Prism' (Promoted SrcSpanInfo) (SrcSpanInfo, Bool, [Type SrcSpanInfo])
625 | _PromotedList = X._PromotedList
626 |
627 | _PromotedCon :: Prism' (Promoted SrcSpanInfo) (SrcSpanInfo, Bool, QName SrcSpanInfo)
628 | _PromotedCon = X._PromotedCon
629 |
630 | _PromotedString :: Prism' (Promoted SrcSpanInfo) (SrcSpanInfo, String, String)
631 | _PromotedString = X._PromotedString
632 |
633 | _PromotedInteger :: Prism' (Promoted SrcSpanInfo) (SrcSpanInfo, Integer, String)
634 | _PromotedInteger = X._PromotedInteger
635 |
636 | _UnkindedVar :: Prism' (TyVarBind SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
637 | _UnkindedVar = X._UnkindedVar
638 |
639 | _KindedVar :: Prism' (TyVarBind SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, Kind SrcSpanInfo)
640 | _KindedVar = X._KindedVar
641 |
642 | _KindList :: Prism' (Kind SrcSpanInfo) (SrcSpanInfo, Kind SrcSpanInfo)
643 | _KindList = X._KindList
644 |
645 | _KindTuple :: Prism' (Kind SrcSpanInfo) (SrcSpanInfo, [Kind SrcSpanInfo])
646 | _KindTuple = X._KindTuple
647 |
648 | _KindApp :: Prism' (Kind SrcSpanInfo) (SrcSpanInfo, Kind SrcSpanInfo, Kind SrcSpanInfo)
649 | _KindApp = X._KindApp
650 |
651 | _KindVar :: Prism' (Kind SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
652 | _KindVar = X._KindVar
653 |
654 | _KindParen :: Prism' (Kind SrcSpanInfo) (SrcSpanInfo, Kind SrcSpanInfo)
655 | _KindParen = X._KindParen
656 |
657 | _KindFn :: Prism' (Kind SrcSpanInfo) (SrcSpanInfo, Kind SrcSpanInfo, Kind SrcSpanInfo)
658 | _KindFn = X._KindFn
659 |
660 | _KindStar :: Prism' (Kind SrcSpanInfo) SrcSpanInfo
661 | _KindStar = X._KindStar
662 |
663 | _Unboxed :: Prism' Boxed ()
664 | _Unboxed = X._Unboxed
665 |
666 | _Boxed :: Prism' Boxed ()
667 | _Boxed = X._Boxed
668 |
669 | _TyQuasiQuote :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, String, String)
670 | _TyQuasiQuote = X._TyQuasiQuote
671 |
672 | _TyWildCard :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Maybe (Name SrcSpanInfo))
673 | _TyWildCard = X._TyWildCard
674 |
675 | _TyBang :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, BangType SrcSpanInfo, Unpackedness SrcSpanInfo, Type SrcSpanInfo)
676 | _TyBang = X._TyBang
677 |
678 | _TySplice :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Splice SrcSpanInfo)
679 | _TySplice = X._TySplice
680 |
681 | _TyEquals :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, Type SrcSpanInfo)
682 | _TyEquals = X._TyEquals
683 |
684 | _TyPromoted :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Promoted SrcSpanInfo)
685 | _TyPromoted = X._TyPromoted
686 |
687 | _TyKind :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, Kind SrcSpanInfo)
688 | _TyKind = X._TyKind
689 |
690 | _TyInfix :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, QName SrcSpanInfo, Type SrcSpanInfo)
691 | _TyInfix = X._TyInfix
692 |
693 | _TyParen :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo)
694 | _TyParen = X._TyParen
695 |
696 | _TyCon :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
697 | _TyCon = X._TyCon
698 |
699 | _TyVar :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
700 | _TyVar = X._TyVar
701 |
702 | _TyApp :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, Type SrcSpanInfo)
703 | _TyApp = X._TyApp
704 |
705 | _TyParArray :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo)
706 | _TyParArray = X._TyParArray
707 |
708 | _TyList :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo)
709 | _TyList = X._TyList
710 |
711 | _TyTuple :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Boxed, [Type SrcSpanInfo])
712 | _TyTuple = X._TyTuple
713 |
714 | _TyFun :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, Type SrcSpanInfo)
715 | _TyFun = X._TyFun
716 |
717 | _TyForall :: Prism' (Type SrcSpanInfo) (SrcSpanInfo, Maybe [TyVarBind SrcSpanInfo], Maybe (Context SrcSpanInfo), Type SrcSpanInfo)
718 | _TyForall = X._TyForall
719 |
720 | _WildCardA :: Prism' (Asst SrcSpanInfo) (SrcSpanInfo, Maybe (Name SrcSpanInfo))
721 | _WildCardA = X._WildCardA
722 |
723 | _ParenA :: Prism' (Asst SrcSpanInfo) (SrcSpanInfo, Asst SrcSpanInfo)
724 | _ParenA = X._ParenA
725 |
726 | _EqualP :: Prism' (Asst SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, Type SrcSpanInfo)
727 | _EqualP = X._EqualP
728 |
729 | _IParam :: Prism' (Asst SrcSpanInfo) (SrcSpanInfo, IPName SrcSpanInfo, Type SrcSpanInfo)
730 | _IParam = X._IParam
731 |
732 | _InfixA :: Prism' (Asst SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, QName SrcSpanInfo, Type SrcSpanInfo)
733 | _InfixA = X._InfixA
734 |
735 | _AppA :: Prism' (Asst SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, [Type SrcSpanInfo])
736 | _AppA = X._AppA
737 |
738 | _ClassA :: Prism' (Asst SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo, [Type SrcSpanInfo])
739 | _ClassA = X._ClassA
740 |
741 | _CxEmpty :: Prism' (Context SrcSpanInfo) SrcSpanInfo
742 | _CxEmpty = X._CxEmpty
743 |
744 | _CxTuple :: Prism' (Context SrcSpanInfo) (SrcSpanInfo, [Asst SrcSpanInfo])
745 | _CxTuple = X._CxTuple
746 |
747 | _CxSingle :: Prism' (Context SrcSpanInfo) (SrcSpanInfo, Asst SrcSpanInfo)
748 | _CxSingle = X._CxSingle
749 |
750 | _GuardedRhss :: Prism' (Rhs SrcSpanInfo) (SrcSpanInfo, [GuardedRhs SrcSpanInfo])
751 | _GuardedRhss = X._GuardedRhss
752 |
753 | _UnGuardedRhs :: Prism' (Rhs SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
754 | _UnGuardedRhs = X._UnGuardedRhs
755 |
756 | _InfixMatch :: Prism' (Match SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo, Name SrcSpanInfo, [Pat SrcSpanInfo], Rhs SrcSpanInfo, Maybe (Binds SrcSpanInfo))
757 | _InfixMatch = X._InfixMatch
758 |
759 | _Match :: Prism' (Match SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, [Pat SrcSpanInfo], Rhs SrcSpanInfo, Maybe (Binds SrcSpanInfo))
760 | _Match = X._Match
761 |
762 | _NoUnpackPragma :: Prism' (Unpackedness SrcSpanInfo) SrcSpanInfo
763 | _NoUnpackPragma = X._NoUnpackPragma
764 |
765 | _NoUnpack :: Prism' (Unpackedness SrcSpanInfo) SrcSpanInfo
766 | _NoUnpack = X._NoUnpack
767 |
768 | _Unpack :: Prism' (Unpackedness SrcSpanInfo) SrcSpanInfo
769 | _Unpack = X._Unpack
770 |
771 | _NoStrictAnnot :: Prism' (BangType SrcSpanInfo) SrcSpanInfo
772 | _NoStrictAnnot = X._NoStrictAnnot
773 |
774 | _LazyTy :: Prism' (BangType SrcSpanInfo) SrcSpanInfo
775 | _LazyTy = X._LazyTy
776 |
777 | _BangedTy :: Prism' (BangType SrcSpanInfo) SrcSpanInfo
778 | _BangedTy = X._BangedTy
779 |
780 | _RecDecl :: Prism' (ConDecl SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, [FieldDecl SrcSpanInfo])
781 | _RecDecl = X._RecDecl
782 |
783 | _InfixConDecl :: Prism' (ConDecl SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, Name SrcSpanInfo, Type SrcSpanInfo)
784 | _InfixConDecl = X._InfixConDecl
785 |
786 | _ConDecl :: Prism' (ConDecl SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, [Type SrcSpanInfo])
787 | _ConDecl = X._ConDecl
788 |
789 | _NewType :: Prism' (DataOrNew SrcSpanInfo) SrcSpanInfo
790 | _NewType = X._NewType
791 |
792 | _DataType :: Prism' (DataOrNew SrcSpanInfo) SrcSpanInfo
793 | _DataType = X._DataType
794 |
795 | _InsGData :: Prism' (InstDecl SrcSpanInfo) (SrcSpanInfo, DataOrNew SrcSpanInfo, Type SrcSpanInfo, Maybe (Kind SrcSpanInfo), [GadtDecl SrcSpanInfo], Maybe (Deriving SrcSpanInfo))
796 | _InsGData = X._InsGData
797 |
798 | _InsData :: Prism' (InstDecl SrcSpanInfo) (SrcSpanInfo, DataOrNew SrcSpanInfo, Type SrcSpanInfo, [QualConDecl SrcSpanInfo], Maybe (Deriving SrcSpanInfo))
799 | _InsData = X._InsData
800 |
801 | _InsType :: Prism' (InstDecl SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, Type SrcSpanInfo)
802 | _InsType = X._InsType
803 |
804 | _InsDecl :: Prism' (InstDecl SrcSpanInfo) (SrcSpanInfo, Decl SrcSpanInfo)
805 | _InsDecl = X._InsDecl
806 |
807 | _ClsDefSig :: Prism' (ClassDecl SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, Type SrcSpanInfo)
808 | _ClsDefSig = X._ClsDefSig
809 |
810 | _ClsTyDef :: Prism' (ClassDecl SrcSpanInfo) (SrcSpanInfo, TypeEqn SrcSpanInfo)
811 | _ClsTyDef = X._ClsTyDef
812 |
813 | _ClsTyFam :: Prism' (ClassDecl SrcSpanInfo) (SrcSpanInfo, DeclHead SrcSpanInfo, Maybe (ResultSig SrcSpanInfo), Maybe (InjectivityInfo SrcSpanInfo))
814 | _ClsTyFam = X._ClsTyFam
815 |
816 | _ClsDataFam :: Prism' (ClassDecl SrcSpanInfo) (SrcSpanInfo, Maybe (Context SrcSpanInfo), DeclHead SrcSpanInfo, Maybe (ResultSig SrcSpanInfo))
817 | _ClsDataFam = X._ClsDataFam
818 |
819 | _ClsDecl :: Prism' (ClassDecl SrcSpanInfo) (SrcSpanInfo, Decl SrcSpanInfo)
820 | _ClsDecl = X._ClsDecl
821 |
822 | _TyVarSig :: Prism' (ResultSig SrcSpanInfo) (SrcSpanInfo, TyVarBind SrcSpanInfo)
823 | _TyVarSig = X._TyVarSig
824 |
825 | _KindSig :: Prism' (ResultSig SrcSpanInfo) (SrcSpanInfo, Kind SrcSpanInfo)
826 | _KindSig = X._KindSig
827 |
828 | _ImplicitBidirectional :: Prism' (PatternSynDirection SrcSpanInfo) ()
829 | _ImplicitBidirectional = X._ImplicitBidirectional
830 |
831 | _Unidirectional :: Prism' (PatternSynDirection SrcSpanInfo) ()
832 | _Unidirectional = X._Unidirectional
833 |
834 | _IPBinds :: Prism' (Binds SrcSpanInfo) (SrcSpanInfo, [IPBind SrcSpanInfo])
835 | _IPBinds = X._IPBinds
836 |
837 | _BDecls :: Prism' (Binds SrcSpanInfo) (SrcSpanInfo, [Decl SrcSpanInfo])
838 | _BDecls = X._BDecls
839 |
840 | _IHApp :: Prism' (InstHead SrcSpanInfo) (SrcSpanInfo, InstHead SrcSpanInfo, Type SrcSpanInfo)
841 | _IHApp = X._IHApp
842 |
843 | _IHParen :: Prism' (InstHead SrcSpanInfo) (SrcSpanInfo, InstHead SrcSpanInfo)
844 | _IHParen = X._IHParen
845 |
846 | _IHInfix :: Prism' (InstHead SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, QName SrcSpanInfo)
847 | _IHInfix = X._IHInfix
848 |
849 | _IHCon :: Prism' (InstHead SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
850 | _IHCon = X._IHCon
851 |
852 | _IParen :: Prism' (InstRule SrcSpanInfo) (SrcSpanInfo, InstRule SrcSpanInfo)
853 | _IParen = X._IParen
854 |
855 | _IRule :: Prism' (InstRule SrcSpanInfo) (SrcSpanInfo, Maybe [TyVarBind SrcSpanInfo], Maybe (Context SrcSpanInfo), InstHead SrcSpanInfo)
856 | _IRule = X._IRule
857 |
858 | _DHApp :: Prism' (DeclHead SrcSpanInfo) (SrcSpanInfo, DeclHead SrcSpanInfo, TyVarBind SrcSpanInfo)
859 | _DHApp = X._DHApp
860 |
861 | _DHParen :: Prism' (DeclHead SrcSpanInfo) (SrcSpanInfo, DeclHead SrcSpanInfo)
862 | _DHParen = X._DHParen
863 |
864 | _DHInfix :: Prism' (DeclHead SrcSpanInfo) (SrcSpanInfo, TyVarBind SrcSpanInfo, Name SrcSpanInfo)
865 | _DHInfix = X._DHInfix
866 |
867 | _DHead :: Prism' (DeclHead SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
868 | _DHead = X._DHead
869 |
870 | _RoleAnnotDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo, [Role SrcSpanInfo])
871 | _RoleAnnotDecl = X._RoleAnnotDecl
872 |
873 | _MinimalPragma :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Maybe (BooleanFormula SrcSpanInfo))
874 | _MinimalPragma = X._MinimalPragma
875 |
876 | _AnnPragma :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Annotation SrcSpanInfo)
877 | _AnnPragma = X._AnnPragma
878 |
879 | _InstSig :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, InstRule SrcSpanInfo)
880 | _InstSig = X._InstSig
881 |
882 | _SpecInlineSig :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Bool, Maybe (Activation SrcSpanInfo), QName SrcSpanInfo, [Type SrcSpanInfo])
883 | _SpecInlineSig = X._SpecInlineSig
884 |
885 | _SpecSig :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Maybe (Activation SrcSpanInfo), QName SrcSpanInfo, [Type SrcSpanInfo])
886 | _SpecSig = X._SpecSig
887 |
888 | _InlineConlikeSig :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Maybe (Activation SrcSpanInfo), QName SrcSpanInfo)
889 | _InlineConlikeSig = X._InlineConlikeSig
890 |
891 | _InlineSig :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Bool, Maybe (Activation SrcSpanInfo), QName SrcSpanInfo)
892 | _InlineSig = X._InlineSig
893 |
894 | _WarnPragmaDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, [([Name SrcSpanInfo], String)])
895 | _WarnPragmaDecl = X._WarnPragmaDecl
896 |
897 | _DeprPragmaDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, [([Name SrcSpanInfo], String)])
898 | _DeprPragmaDecl = X._DeprPragmaDecl
899 |
900 | _RulePragmaDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, [Rule SrcSpanInfo])
901 | _RulePragmaDecl = X._RulePragmaDecl
902 |
903 | _ForExp :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, CallConv SrcSpanInfo, Maybe String, Name SrcSpanInfo, Type SrcSpanInfo)
904 | _ForExp = X._ForExp
905 |
906 | _ForImp :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, CallConv SrcSpanInfo, Maybe (Safety SrcSpanInfo), Maybe String, Name SrcSpanInfo, Type SrcSpanInfo)
907 | _ForImp = X._ForImp
908 |
909 | _PatSyn :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo, Pat SrcSpanInfo, PatternSynDirection SrcSpanInfo)
910 | _PatSyn = X._PatSyn
911 |
912 | _PatBind :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Pat SrcSpanInfo, Rhs SrcSpanInfo, Maybe (Binds SrcSpanInfo))
913 | _PatBind = X._PatBind
914 |
915 | _FunBind :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, [Match SrcSpanInfo])
916 | _FunBind = X._FunBind
917 |
918 | _PatSynSig :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, Maybe [TyVarBind SrcSpanInfo], Maybe (Context SrcSpanInfo), Maybe (Context SrcSpanInfo), Type SrcSpanInfo)
919 | _PatSynSig = X._PatSynSig
920 |
921 | _TypeSig :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, [Name SrcSpanInfo], Type SrcSpanInfo)
922 | _TypeSig = X._TypeSig
923 |
924 | _SpliceDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Exp SrcSpanInfo)
925 | _SpliceDecl = X._SpliceDecl
926 |
927 | _DefaultDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, [Type SrcSpanInfo])
928 | _DefaultDecl = X._DefaultDecl
929 |
930 | _InfixDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Assoc SrcSpanInfo, Maybe Int, [Op SrcSpanInfo])
931 | _InfixDecl = X._InfixDecl
932 |
933 | _DerivDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Maybe (Overlap SrcSpanInfo), InstRule SrcSpanInfo)
934 | _DerivDecl = X._DerivDecl
935 |
936 | _InstDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Maybe (Overlap SrcSpanInfo), InstRule SrcSpanInfo, Maybe [InstDecl SrcSpanInfo])
937 | _InstDecl = X._InstDecl
938 |
939 | _ClassDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Maybe (Context SrcSpanInfo), DeclHead SrcSpanInfo, [FunDep SrcSpanInfo], Maybe [ClassDecl SrcSpanInfo])
940 | _ClassDecl = X._ClassDecl
941 |
942 | _GDataInsDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, DataOrNew SrcSpanInfo, Type SrcSpanInfo, Maybe (Kind SrcSpanInfo), [GadtDecl SrcSpanInfo], Maybe (Deriving SrcSpanInfo))
943 | _GDataInsDecl = X._GDataInsDecl
944 |
945 | _DataInsDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, DataOrNew SrcSpanInfo, Type SrcSpanInfo, [QualConDecl SrcSpanInfo], Maybe (Deriving SrcSpanInfo))
946 | _DataInsDecl = X._DataInsDecl
947 |
948 | _TypeInsDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Type SrcSpanInfo, Type SrcSpanInfo)
949 | _TypeInsDecl = X._TypeInsDecl
950 |
951 | _DataFamDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, Maybe (Context SrcSpanInfo), DeclHead SrcSpanInfo, Maybe (ResultSig SrcSpanInfo))
952 | _DataFamDecl = X._DataFamDecl
953 |
954 | _GDataDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, DataOrNew SrcSpanInfo, Maybe (Context SrcSpanInfo), DeclHead SrcSpanInfo, Maybe (Kind SrcSpanInfo), [GadtDecl SrcSpanInfo], Maybe (Deriving SrcSpanInfo))
955 | _GDataDecl = X._GDataDecl
956 |
957 | _DataDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, DataOrNew SrcSpanInfo, Maybe (Context SrcSpanInfo), DeclHead SrcSpanInfo, [QualConDecl SrcSpanInfo], Maybe (Deriving SrcSpanInfo))
958 | _DataDecl = X._DataDecl
959 |
960 | _ClosedTypeFamDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, DeclHead SrcSpanInfo, Maybe (ResultSig SrcSpanInfo), Maybe (InjectivityInfo SrcSpanInfo), [TypeEqn SrcSpanInfo])
961 | _ClosedTypeFamDecl = X._ClosedTypeFamDecl
962 |
963 | _TypeFamDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, DeclHead SrcSpanInfo, Maybe (ResultSig SrcSpanInfo), Maybe (InjectivityInfo SrcSpanInfo))
964 | _TypeFamDecl = X._TypeFamDecl
965 |
966 | _TypeDecl :: Prism' (Decl SrcSpanInfo) (SrcSpanInfo, DeclHead SrcSpanInfo, Type SrcSpanInfo)
967 | _TypeDecl = X._TypeDecl
968 |
969 | _PatternNamespace :: Prism' (Namespace SrcSpanInfo) SrcSpanInfo
970 | _PatternNamespace = X._PatternNamespace
971 |
972 | _TypeNamespace :: Prism' (Namespace SrcSpanInfo) SrcSpanInfo
973 | _TypeNamespace = X._TypeNamespace
974 |
975 | _NoNamespace :: Prism' (Namespace SrcSpanInfo) SrcSpanInfo
976 | _NoNamespace = X._NoNamespace
977 |
978 | _AssocRight :: Prism' (Assoc SrcSpanInfo) SrcSpanInfo
979 | _AssocRight = X._AssocRight
980 |
981 | _AssocLeft :: Prism' (Assoc SrcSpanInfo) SrcSpanInfo
982 | _AssocLeft = X._AssocLeft
983 |
984 | _AssocNone :: Prism' (Assoc SrcSpanInfo) SrcSpanInfo
985 | _AssocNone = X._AssocNone
986 |
987 | _IThingWith :: Prism' (ImportSpec SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, [CName SrcSpanInfo])
988 | _IThingWith = X._IThingWith
989 |
990 | _IThingAll :: Prism' (ImportSpec SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
991 | _IThingAll = X._IThingAll
992 |
993 | _IAbs :: Prism' (ImportSpec SrcSpanInfo) (SrcSpanInfo, Namespace SrcSpanInfo, Name SrcSpanInfo)
994 | _IAbs = X._IAbs
995 |
996 | _IVar :: Prism' (ImportSpec SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo)
997 | _IVar = X._IVar
998 |
999 | _EWildcard :: Prism' (EWildcard SrcSpanInfo) (SrcSpanInfo, Int)
1000 | _EWildcard = X._EWildcard
1001 |
1002 | _NoWildcard :: Prism' (EWildcard SrcSpanInfo) SrcSpanInfo
1003 | _NoWildcard = X._NoWildcard
1004 |
1005 | _EModuleContents :: Prism' (ExportSpec SrcSpanInfo) (SrcSpanInfo, ModuleName SrcSpanInfo)
1006 | _EModuleContents = X._EModuleContents
1007 |
1008 | _EThingWith :: Prism' (ExportSpec SrcSpanInfo) (SrcSpanInfo, EWildcard SrcSpanInfo, QName SrcSpanInfo, [CName SrcSpanInfo])
1009 | _EThingWith = X._EThingWith
1010 |
1011 | _EAbs :: Prism' (ExportSpec SrcSpanInfo) (SrcSpanInfo, Namespace SrcSpanInfo, QName SrcSpanInfo)
1012 | _EAbs = X._EAbs
1013 |
1014 | _EVar :: Prism' (ExportSpec SrcSpanInfo) (SrcSpanInfo, QName SrcSpanInfo)
1015 | _EVar = X._EVar
1016 |
1017 | _WarnText :: Prism' (WarningText SrcSpanInfo) (SrcSpanInfo, String)
1018 | _WarnText = X._WarnText
1019 |
1020 | _DeprText :: Prism' (WarningText SrcSpanInfo) (SrcSpanInfo, String)
1021 | _DeprText = X._DeprText
1022 |
1023 | _XmlHybrid :: Prism' (Module SrcSpanInfo) (SrcSpanInfo, Maybe (ModuleHead SrcSpanInfo), [ModulePragma SrcSpanInfo], [ImportDecl SrcSpanInfo], [Decl SrcSpanInfo], XName SrcSpanInfo, [XAttr SrcSpanInfo], Maybe (Exp SrcSpanInfo), [Exp SrcSpanInfo])
1024 | _XmlHybrid = X._XmlHybrid
1025 |
1026 | _XmlPage :: Prism' (Module SrcSpanInfo) (SrcSpanInfo, ModuleName SrcSpanInfo, [ModulePragma SrcSpanInfo], XName SrcSpanInfo, [XAttr SrcSpanInfo], Maybe (Exp SrcSpanInfo), [Exp SrcSpanInfo])
1027 | _XmlPage = X._XmlPage
1028 |
1029 | _Module :: Prism' (Module SrcSpanInfo) (SrcSpanInfo, Maybe (ModuleHead SrcSpanInfo), [ModulePragma SrcSpanInfo], [ImportDecl SrcSpanInfo], [Decl SrcSpanInfo])
1030 | _Module = X._Module
1031 |
1032 | _ParenFormula' :: Prism' (BooleanFormula v) (C_ParenFormula v)
1033 | _ParenFormula' = X._ParenFormula'
1034 |
1035 | _OrFormula' :: Prism' (BooleanFormula v) (C_OrFormula v)
1036 | _OrFormula' = X._OrFormula'
1037 |
1038 | _AndFormula' :: Prism' (BooleanFormula v) (C_AndFormula v)
1039 | _AndFormula' = X._AndFormula'
1040 |
1041 | _VarFormula' :: Prism' (BooleanFormula v) (C_VarFormula v)
1042 | _VarFormula' = X._VarFormula'
1043 |
1044 | _ModuleAnn' :: Prism' (Annotation v) (C_ModuleAnn v)
1045 | _ModuleAnn' = X._ModuleAnn'
1046 |
1047 | _TypeAnn' :: Prism' (Annotation v) (C_TypeAnn v)
1048 | _TypeAnn' = X._TypeAnn'
1049 |
1050 | _Ann' :: Prism' (Annotation v) (C_Ann v)
1051 | _Ann' = X._Ann'
1052 |
1053 | _ActiveUntil' :: Prism' (Activation v) (C_ActiveUntil v)
1054 | _ActiveUntil' = X._ActiveUntil'
1055 |
1056 | _ActiveFrom' :: Prism' (Activation v) (C_ActiveFrom v)
1057 | _ActiveFrom' = X._ActiveFrom'
1058 |
1059 | _TypedRuleVar' :: Prism' (RuleVar v) (C_TypedRuleVar v)
1060 | _TypedRuleVar' = X._TypedRuleVar'
1061 |
1062 | _RuleVar' :: Prism' (RuleVar v) (C_RuleVar v)
1063 | _RuleVar' = X._RuleVar'
1064 |
1065 | _Incoherent' :: Prism' (Overlap v) (C_Incoherent v)
1066 | _Incoherent' = X._Incoherent'
1067 |
1068 | _Overlap' :: Prism' (Overlap v) (C_Overlap v)
1069 | _Overlap' = X._Overlap'
1070 |
1071 | _NoOverlap' :: Prism' (Overlap v) (C_NoOverlap v)
1072 | _NoOverlap' = X._NoOverlap'
1073 |
1074 | _UnknownTool' :: Prism' Tool C_UnknownTool
1075 | _UnknownTool' = X._UnknownTool'
1076 |
1077 | _HADDOCK' :: Prism' Tool C_HADDOCK
1078 | _HADDOCK' = X._HADDOCK'
1079 |
1080 | _YHC' :: Prism' Tool C_YHC
1081 | _YHC' = X._YHC'
1082 |
1083 | _NHC98' :: Prism' Tool C_NHC98
1084 | _NHC98' = X._NHC98'
1085 |
1086 | _HUGS' :: Prism' Tool C_HUGS
1087 | _HUGS' = X._HUGS'
1088 |
1089 | _GHC' :: Prism' Tool C_GHC
1090 | _GHC' = X._GHC'
1091 |
1092 | _AnnModulePragma' :: Prism' (ModulePragma v) (C_AnnModulePragma v)
1093 | _AnnModulePragma' = X._AnnModulePragma'
1094 |
1095 | _OptionsPragma' :: Prism' (ModulePragma v) (C_OptionsPragma v)
1096 | _OptionsPragma' = X._OptionsPragma'
1097 |
1098 | _LanguagePragma' :: Prism' (ModulePragma v) (C_LanguagePragma v)
1099 | _LanguagePragma' = X._LanguagePragma'
1100 |
1101 | _CApi' :: Prism' (CallConv v) (C_CApi v)
1102 | _CApi' = X._CApi'
1103 |
1104 | _JavaScript' :: Prism' (CallConv v) (C_JavaScript v)
1105 | _JavaScript' = X._JavaScript'
1106 |
1107 | _Js' :: Prism' (CallConv v) (C_Js v)
1108 | _Js' = X._Js'
1109 |
1110 | _Jvm' :: Prism' (CallConv v) (C_Jvm v)
1111 | _Jvm' = X._Jvm'
1112 |
1113 | _DotNet' :: Prism' (CallConv v) (C_DotNet v)
1114 | _DotNet' = X._DotNet'
1115 |
1116 | _CPlusPlus' :: Prism' (CallConv v) (C_CPlusPlus v)
1117 | _CPlusPlus' = X._CPlusPlus'
1118 |
1119 | _CCall' :: Prism' (CallConv v) (C_CCall v)
1120 | _CCall' = X._CCall'
1121 |
1122 | _StdCall' :: Prism' (CallConv v) (C_StdCall v)
1123 | _StdCall' = X._StdCall'
1124 |
1125 | _PlayInterruptible' :: Prism' (Safety v) (C_PlayInterruptible v)
1126 | _PlayInterruptible' = X._PlayInterruptible'
1127 |
1128 | _PlaySafe' :: Prism' (Safety v) (C_PlaySafe v)
1129 | _PlaySafe' = X._PlaySafe'
1130 |
1131 | _PlayRisky' :: Prism' (Safety v) (C_PlayRisky v)
1132 | _PlayRisky' = X._PlayRisky'
1133 |
1134 | _ParenSplice' :: Prism' (Splice v) (C_ParenSplice v)
1135 | _ParenSplice' = X._ParenSplice'
1136 |
1137 | _IdSplice' :: Prism' (Splice v) (C_IdSplice v)
1138 | _IdSplice' = X._IdSplice'
1139 |
1140 | _DeclBracket' :: Prism' (Bracket v) (C_DeclBracket v)
1141 | _DeclBracket' = X._DeclBracket'
1142 |
1143 | _TypeBracket' :: Prism' (Bracket v) (C_TypeBracket v)
1144 | _TypeBracket' = X._TypeBracket'
1145 |
1146 | _PatBracket' :: Prism' (Bracket v) (C_PatBracket v)
1147 | _PatBracket' = X._PatBracket'
1148 |
1149 | _ExpBracket' :: Prism' (Bracket v) (C_ExpBracket v)
1150 | _ExpBracket' = X._ExpBracket'
1151 |
1152 | _RoleWildcard' :: Prism' (Role v) (C_RoleWildcard v)
1153 | _RoleWildcard' = X._RoleWildcard'
1154 |
1155 | _Phantom' :: Prism' (Role v) (C_Phantom v)
1156 | _Phantom' = X._Phantom'
1157 |
1158 | _Representational' :: Prism' (Role v) (C_Representational v)
1159 | _Representational' = X._Representational'
1160 |
1161 | _Nominal' :: Prism' (Role v) (C_Nominal v)
1162 | _Nominal' = X._Nominal'
1163 |
1164 | _XDomName' :: Prism' (XName v) (C_XDomName v)
1165 | _XDomName' = X._XDomName'
1166 |
1167 | _XName' :: Prism' (XName v) (C_XName v)
1168 | _XName' = X._XName'
1169 |
1170 | _IPLin' :: Prism' (IPName v) (C_IPLin v)
1171 | _IPLin' = X._IPLin'
1172 |
1173 | _IPDup' :: Prism' (IPName v) (C_IPDup v)
1174 | _IPDup' = X._IPDup'
1175 |
1176 | _ConName' :: Prism' (CName v) (C_ConName v)
1177 | _ConName' = X._ConName'
1178 |
1179 | _VarName' :: Prism' (CName v) (C_VarName v)
1180 | _VarName' = X._VarName'
1181 |
1182 | _UnboxedSingleCon' :: Prism' (SpecialCon v) (C_UnboxedSingleCon v)
1183 | _UnboxedSingleCon' = X._UnboxedSingleCon'
1184 |
1185 | _Cons' :: Prism' (SpecialCon v) (C_Cons v)
1186 | _Cons' = X._Cons'
1187 |
1188 | _TupleCon' :: Prism' (SpecialCon v) (C_TupleCon v)
1189 | _TupleCon' = X._TupleCon'
1190 |
1191 | _FunCon' :: Prism' (SpecialCon v) (C_FunCon v)
1192 | _FunCon' = X._FunCon'
1193 |
1194 | _ListCon' :: Prism' (SpecialCon v) (C_ListCon v)
1195 | _ListCon' = X._ListCon'
1196 |
1197 | _UnitCon' :: Prism' (SpecialCon v) (C_UnitCon v)
1198 | _UnitCon' = X._UnitCon'
1199 |
1200 | _ConOp' :: Prism' (Op v) (C_ConOp v)
1201 | _ConOp' = X._ConOp'
1202 |
1203 | _VarOp' :: Prism' (Op v) (C_VarOp v)
1204 | _VarOp' = X._VarOp'
1205 |
1206 | _QConOp' :: Prism' (QOp v) (C_QConOp v)
1207 | _QConOp' = X._QConOp'
1208 |
1209 | _QVarOp' :: Prism' (QOp v) (C_QVarOp v)
1210 | _QVarOp' = X._QVarOp'
1211 |
1212 | _Symbol' :: Prism' (Name v) (C_Symbol v)
1213 | _Symbol' = X._Symbol'
1214 |
1215 | _Ident' :: Prism' (Name v) (C_Ident v)
1216 | _Ident' = X._Ident'
1217 |
1218 | _Special' :: Prism' (QName v) (C_Special v)
1219 | _Special' = X._Special'
1220 |
1221 | _UnQual' :: Prism' (QName v) (C_UnQual v)
1222 | _UnQual' = X._UnQual'
1223 |
1224 | _Qual' :: Prism' (QName v) (C_Qual v)
1225 | _Qual' = X._Qual'
1226 |
1227 | _Negative' :: Prism' (Sign v) (C_Negative v)
1228 | _Negative' = X._Negative'
1229 |
1230 | _Signless' :: Prism' (Sign v) (C_Signless v)
1231 | _Signless' = X._Signless'
1232 |
1233 | _PrimString' :: Prism' (Literal v) (C_PrimString v)
1234 | _PrimString' = X._PrimString'
1235 |
1236 | _PrimChar' :: Prism' (Literal v) (C_PrimChar v)
1237 | _PrimChar' = X._PrimChar'
1238 |
1239 | _PrimDouble' :: Prism' (Literal v) (C_PrimDouble v)
1240 | _PrimDouble' = X._PrimDouble'
1241 |
1242 | _PrimFloat' :: Prism' (Literal v) (C_PrimFloat v)
1243 | _PrimFloat' = X._PrimFloat'
1244 |
1245 | _PrimWord' :: Prism' (Literal v) (C_PrimWord v)
1246 | _PrimWord' = X._PrimWord'
1247 |
1248 | _PrimInt' :: Prism' (Literal v) (C_PrimInt v)
1249 | _PrimInt' = X._PrimInt'
1250 |
1251 | _Frac' :: Prism' (Literal v) (C_Frac v)
1252 | _Frac' = X._Frac'
1253 |
1254 | _Int' :: Prism' (Literal v) (C_Int v)
1255 | _Int' = X._Int'
1256 |
1257 | _String' :: Prism' (Literal v) (C_String v)
1258 | _String' = X._String'
1259 |
1260 | _Char' :: Prism' (Literal v) (C_Char v)
1261 | _Char' = X._Char'
1262 |
1263 | _RPOptG' :: Prism' (RPatOp v) (C_RPOptG v)
1264 | _RPOptG' = X._RPOptG'
1265 |
1266 | _RPOpt' :: Prism' (RPatOp v) (C_RPOpt v)
1267 | _RPOpt' = X._RPOpt'
1268 |
1269 | _RPPlusG' :: Prism' (RPatOp v) (C_RPPlusG v)
1270 | _RPPlusG' = X._RPPlusG'
1271 |
1272 | _RPPlus' :: Prism' (RPatOp v) (C_RPPlus v)
1273 | _RPPlus' = X._RPPlus'
1274 |
1275 | _RPStarG' :: Prism' (RPatOp v) (C_RPStarG v)
1276 | _RPStarG' = X._RPStarG'
1277 |
1278 | _RPStar' :: Prism' (RPatOp v) (C_RPStar v)
1279 | _RPStar' = X._RPStar'
1280 |
1281 | _RPPat' :: Prism' (RPat v) (C_RPPat v)
1282 | _RPPat' = X._RPPat'
1283 |
1284 | _RPParen' :: Prism' (RPat v) (C_RPParen v)
1285 | _RPParen' = X._RPParen'
1286 |
1287 | _RPAs' :: Prism' (RPat v) (C_RPAs v)
1288 | _RPAs' = X._RPAs'
1289 |
1290 | _RPCAs' :: Prism' (RPat v) (C_RPCAs v)
1291 | _RPCAs' = X._RPCAs'
1292 |
1293 | _RPGuard' :: Prism' (RPat v) (C_RPGuard v)
1294 | _RPGuard' = X._RPGuard'
1295 |
1296 | _RPSeq' :: Prism' (RPat v) (C_RPSeq v)
1297 | _RPSeq' = X._RPSeq'
1298 |
1299 | _RPEither' :: Prism' (RPat v) (C_RPEither v)
1300 | _RPEither' = X._RPEither'
1301 |
1302 | _RPOp' :: Prism' (RPat v) (C_RPOp v)
1303 | _RPOp' = X._RPOp'
1304 |
1305 | _PFieldWildcard' :: Prism' (PatField v) (C_PFieldWildcard v)
1306 | _PFieldWildcard' = X._PFieldWildcard'
1307 |
1308 | _PFieldPun' :: Prism' (PatField v) (C_PFieldPun v)
1309 | _PFieldPun' = X._PFieldPun'
1310 |
1311 | _PFieldPat' :: Prism' (PatField v) (C_PFieldPat v)
1312 | _PFieldPat' = X._PFieldPat'
1313 |
1314 | _PBangPat' :: Prism' (Pat v) (C_PBangPat v)
1315 | _PBangPat' = X._PBangPat'
1316 |
1317 | _PQuasiQuote' :: Prism' (Pat v) (C_PQuasiQuote v)
1318 | _PQuasiQuote' = X._PQuasiQuote'
1319 |
1320 | _PXRPats' :: Prism' (Pat v) (C_PXRPats v)
1321 | _PXRPats' = X._PXRPats'
1322 |
1323 | _PXPatTag' :: Prism' (Pat v) (C_PXPatTag v)
1324 | _PXPatTag' = X._PXPatTag'
1325 |
1326 | _PXPcdata' :: Prism' (Pat v) (C_PXPcdata v)
1327 | _PXPcdata' = X._PXPcdata'
1328 |
1329 | _PXETag' :: Prism' (Pat v) (C_PXETag v)
1330 | _PXETag' = X._PXETag'
1331 |
1332 | _PXTag' :: Prism' (Pat v) (C_PXTag v)
1333 | _PXTag' = X._PXTag'
1334 |
1335 | _PRPat' :: Prism' (Pat v) (C_PRPat v)
1336 | _PRPat' = X._PRPat'
1337 |
1338 | _PViewPat' :: Prism' (Pat v) (C_PViewPat v)
1339 | _PViewPat' = X._PViewPat'
1340 |
1341 | _PatTypeSig' :: Prism' (Pat v) (C_PatTypeSig v)
1342 | _PatTypeSig' = X._PatTypeSig'
1343 |
1344 | _PIrrPat' :: Prism' (Pat v) (C_PIrrPat v)
1345 | _PIrrPat' = X._PIrrPat'
1346 |
1347 | _PWildCard' :: Prism' (Pat v) (C_PWildCard v)
1348 | _PWildCard' = X._PWildCard'
1349 |
1350 | _PAsPat' :: Prism' (Pat v) (C_PAsPat v)
1351 | _PAsPat' = X._PAsPat'
1352 |
1353 | _PRec' :: Prism' (Pat v) (C_PRec v)
1354 | _PRec' = X._PRec'
1355 |
1356 | _PParen' :: Prism' (Pat v) (C_PParen v)
1357 | _PParen' = X._PParen'
1358 |
1359 | _PList' :: Prism' (Pat v) (C_PList v)
1360 | _PList' = X._PList'
1361 |
1362 | _PTuple' :: Prism' (Pat v) (C_PTuple v)
1363 | _PTuple' = X._PTuple'
1364 |
1365 | _PApp' :: Prism' (Pat v) (C_PApp v)
1366 | _PApp' = X._PApp'
1367 |
1368 | _PInfixApp' :: Prism' (Pat v) (C_PInfixApp v)
1369 | _PInfixApp' = X._PInfixApp'
1370 |
1371 | _PNPlusK' :: Prism' (Pat v) (C_PNPlusK v)
1372 | _PNPlusK' = X._PNPlusK'
1373 |
1374 | _PLit' :: Prism' (Pat v) (C_PLit v)
1375 | _PLit' = X._PLit'
1376 |
1377 | _PVar' :: Prism' (Pat v) (C_PVar v)
1378 | _PVar' = X._PVar'
1379 |
1380 | _FieldWildcard' :: Prism' (FieldUpdate v) (C_FieldWildcard v)
1381 | _FieldWildcard' = X._FieldWildcard'
1382 |
1383 | _FieldPun' :: Prism' (FieldUpdate v) (C_FieldPun v)
1384 | _FieldPun' = X._FieldPun'
1385 |
1386 | _FieldUpdate' :: Prism' (FieldUpdate v) (C_FieldUpdate v)
1387 | _FieldUpdate' = X._FieldUpdate'
1388 |
1389 | _GroupByUsing' :: Prism' (QualStmt v) (C_GroupByUsing v)
1390 | _GroupByUsing' = X._GroupByUsing'
1391 |
1392 | _GroupUsing' :: Prism' (QualStmt v) (C_GroupUsing v)
1393 | _GroupUsing' = X._GroupUsing'
1394 |
1395 | _GroupBy' :: Prism' (QualStmt v) (C_GroupBy v)
1396 | _GroupBy' = X._GroupBy'
1397 |
1398 | _ThenBy' :: Prism' (QualStmt v) (C_ThenBy v)
1399 | _ThenBy' = X._ThenBy'
1400 |
1401 | _ThenTrans' :: Prism' (QualStmt v) (C_ThenTrans v)
1402 | _ThenTrans' = X._ThenTrans'
1403 |
1404 | _QualStmt' :: Prism' (QualStmt v) (C_QualStmt v)
1405 | _QualStmt' = X._QualStmt'
1406 |
1407 | _RecStmt' :: Prism' (Stmt v) (C_RecStmt v)
1408 | _RecStmt' = X._RecStmt'
1409 |
1410 | _LetStmt' :: Prism' (Stmt v) (C_LetStmt v)
1411 | _LetStmt' = X._LetStmt'
1412 |
1413 | _Qualifier' :: Prism' (Stmt v) (C_Qualifier v)
1414 | _Qualifier' = X._Qualifier'
1415 |
1416 | _Generator' :: Prism' (Stmt v) (C_Generator v)
1417 | _Generator' = X._Generator'
1418 |
1419 | _ExprHole' :: Prism' (Exp v) (C_ExprHole v)
1420 | _ExprHole' = X._ExprHole'
1421 |
1422 | _LCase' :: Prism' (Exp v) (C_LCase v)
1423 | _LCase' = X._LCase'
1424 |
1425 | _RightArrHighApp' :: Prism' (Exp v) (C_RightArrHighApp v)
1426 | _RightArrHighApp' = X._RightArrHighApp'
1427 |
1428 | _LeftArrHighApp' :: Prism' (Exp v) (C_LeftArrHighApp v)
1429 | _LeftArrHighApp' = X._LeftArrHighApp'
1430 |
1431 | _RightArrApp' :: Prism' (Exp v) (C_RightArrApp v)
1432 | _RightArrApp' = X._RightArrApp'
1433 |
1434 | _LeftArrApp' :: Prism' (Exp v) (C_LeftArrApp v)
1435 | _LeftArrApp' = X._LeftArrApp'
1436 |
1437 | _Proc' :: Prism' (Exp v) (C_Proc v)
1438 | _Proc' = X._Proc'
1439 |
1440 | _GenPragma' :: Prism' (Exp v) (C_GenPragma v)
1441 | _GenPragma' = X._GenPragma'
1442 |
1443 | _SCCPragma' :: Prism' (Exp v) (C_SCCPragma v)
1444 | _SCCPragma' = X._SCCPragma'
1445 |
1446 | _CorePragma' :: Prism' (Exp v) (C_CorePragma v)
1447 | _CorePragma' = X._CorePragma'
1448 |
1449 | _XChildTag' :: Prism' (Exp v) (C_XChildTag v)
1450 | _XChildTag' = X._XChildTag'
1451 |
1452 | _XExpTag' :: Prism' (Exp v) (C_XExpTag v)
1453 | _XExpTag' = X._XExpTag'
1454 |
1455 | _XPcdata' :: Prism' (Exp v) (C_XPcdata v)
1456 | _XPcdata' = X._XPcdata'
1457 |
1458 | _XETag' :: Prism' (Exp v) (C_XETag v)
1459 | _XETag' = X._XETag'
1460 |
1461 | _XTag' :: Prism' (Exp v) (C_XTag v)
1462 | _XTag' = X._XTag'
1463 |
1464 | _TypeApp' :: Prism' (Exp v) (C_TypeApp v)
1465 | _TypeApp' = X._TypeApp'
1466 |
1467 | _QuasiQuote' :: Prism' (Exp v) (C_QuasiQuote v)
1468 | _QuasiQuote' = X._QuasiQuote'
1469 |
1470 | _SpliceExp' :: Prism' (Exp v) (C_SpliceExp v)
1471 | _SpliceExp' = X._SpliceExp'
1472 |
1473 | _BracketExp' :: Prism' (Exp v) (C_BracketExp v)
1474 | _BracketExp' = X._BracketExp'
1475 |
1476 | _TypQuote' :: Prism' (Exp v) (C_TypQuote v)
1477 | _TypQuote' = X._TypQuote'
1478 |
1479 | _VarQuote' :: Prism' (Exp v) (C_VarQuote v)
1480 | _VarQuote' = X._VarQuote'
1481 |
1482 | _ExpTypeSig' :: Prism' (Exp v) (C_ExpTypeSig v)
1483 | _ExpTypeSig' = X._ExpTypeSig'
1484 |
1485 | _ParArrayComp' :: Prism' (Exp v) (C_ParArrayComp v)
1486 | _ParArrayComp' = X._ParArrayComp'
1487 |
1488 | _ParComp' :: Prism' (Exp v) (C_ParComp v)
1489 | _ParComp' = X._ParComp'
1490 |
1491 | _ListComp' :: Prism' (Exp v) (C_ListComp v)
1492 | _ListComp' = X._ListComp'
1493 |
1494 | _ParArrayFromThenTo' :: Prism' (Exp v) (C_ParArrayFromThenTo v)
1495 | _ParArrayFromThenTo' = X._ParArrayFromThenTo'
1496 |
1497 | _ParArrayFromTo' :: Prism' (Exp v) (C_ParArrayFromTo v)
1498 | _ParArrayFromTo' = X._ParArrayFromTo'
1499 |
1500 | _EnumFromThenTo' :: Prism' (Exp v) (C_EnumFromThenTo v)
1501 | _EnumFromThenTo' = X._EnumFromThenTo'
1502 |
1503 | _EnumFromThen' :: Prism' (Exp v) (C_EnumFromThen v)
1504 | _EnumFromThen' = X._EnumFromThen'
1505 |
1506 | _EnumFromTo' :: Prism' (Exp v) (C_EnumFromTo v)
1507 | _EnumFromTo' = X._EnumFromTo'
1508 |
1509 | _EnumFrom' :: Prism' (Exp v) (C_EnumFrom v)
1510 | _EnumFrom' = X._EnumFrom'
1511 |
1512 | _RecUpdate' :: Prism' (Exp v) (C_RecUpdate v)
1513 | _RecUpdate' = X._RecUpdate'
1514 |
1515 | _RecConstr' :: Prism' (Exp v) (C_RecConstr v)
1516 | _RecConstr' = X._RecConstr'
1517 |
1518 | _RightSection' :: Prism' (Exp v) (C_RightSection v)
1519 | _RightSection' = X._RightSection'
1520 |
1521 | _LeftSection' :: Prism' (Exp v) (C_LeftSection v)
1522 | _LeftSection' = X._LeftSection'
1523 |
1524 | _Paren' :: Prism' (Exp v) (C_Paren v)
1525 | _Paren' = X._Paren'
1526 |
1527 | _ParArray' :: Prism' (Exp v) (C_ParArray v)
1528 | _ParArray' = X._ParArray'
1529 |
1530 | _List' :: Prism' (Exp v) (C_List v)
1531 | _List' = X._List'
1532 |
1533 | _TupleSection' :: Prism' (Exp v) (C_TupleSection v)
1534 | _TupleSection' = X._TupleSection'
1535 |
1536 | _Tuple' :: Prism' (Exp v) (C_Tuple v)
1537 | _Tuple' = X._Tuple'
1538 |
1539 | _MDo' :: Prism' (Exp v) (C_MDo v)
1540 | _MDo' = X._MDo'
1541 |
1542 | _Do' :: Prism' (Exp v) (C_Do v)
1543 | _Do' = X._Do'
1544 |
1545 | _Case' :: Prism' (Exp v) (C_Case v)
1546 | _Case' = X._Case'
1547 |
1548 | _MultiIf' :: Prism' (Exp v) (C_MultiIf v)
1549 | _MultiIf' = X._MultiIf'
1550 |
1551 | _If' :: Prism' (Exp v) (C_If v)
1552 | _If' = X._If'
1553 |
1554 | _Let' :: Prism' (Exp v) (C_Let v)
1555 | _Let' = X._Let'
1556 |
1557 | _Lambda' :: Prism' (Exp v) (C_Lambda v)
1558 | _Lambda' = X._Lambda'
1559 |
1560 | _NegApp' :: Prism' (Exp v) (C_NegApp v)
1561 | _NegApp' = X._NegApp'
1562 |
1563 | _App' :: Prism' (Exp v) (C_App v)
1564 | _App' = X._App'
1565 |
1566 | _InfixApp' :: Prism' (Exp v) (C_InfixApp v)
1567 | _InfixApp' = X._InfixApp'
1568 |
1569 | _Lit' :: Prism' (Exp v) (C_Lit v)
1570 | _Lit' = X._Lit'
1571 |
1572 | _Con' :: Prism' (Exp v) (C_Con v)
1573 | _Con' = X._Con'
1574 |
1575 | _IPVar' :: Prism' (Exp v) (C_IPVar v)
1576 | _IPVar' = X._IPVar'
1577 |
1578 | _OverloadedLabel' :: Prism' (Exp v) (C_OverloadedLabel v)
1579 | _OverloadedLabel' = X._OverloadedLabel'
1580 |
1581 | _Var' :: Prism' (Exp v) (C_Var v)
1582 | _Var' = X._Var'
1583 |
1584 | _PromotedUnit' :: Prism' (Promoted v) (C_PromotedUnit v)
1585 | _PromotedUnit' = X._PromotedUnit'
1586 |
1587 | _PromotedTuple' :: Prism' (Promoted v) (C_PromotedTuple v)
1588 | _PromotedTuple' = X._PromotedTuple'
1589 |
1590 | _PromotedList' :: Prism' (Promoted v) (C_PromotedList v)
1591 | _PromotedList' = X._PromotedList'
1592 |
1593 | _PromotedCon' :: Prism' (Promoted v) (C_PromotedCon v)
1594 | _PromotedCon' = X._PromotedCon'
1595 |
1596 | _PromotedString' :: Prism' (Promoted v) (C_PromotedString v)
1597 | _PromotedString' = X._PromotedString'
1598 |
1599 | _PromotedInteger' :: Prism' (Promoted v) (C_PromotedInteger v)
1600 | _PromotedInteger' = X._PromotedInteger'
1601 |
1602 | _UnkindedVar' :: Prism' (TyVarBind v) (C_UnkindedVar v)
1603 | _UnkindedVar' = X._UnkindedVar'
1604 |
1605 | _KindedVar' :: Prism' (TyVarBind v) (C_KindedVar v)
1606 | _KindedVar' = X._KindedVar'
1607 |
1608 | _KindList' :: Prism' (Kind v) (C_KindList v)
1609 | _KindList' = X._KindList'
1610 |
1611 | _KindTuple' :: Prism' (Kind v) (C_KindTuple v)
1612 | _KindTuple' = X._KindTuple'
1613 |
1614 | _KindApp' :: Prism' (Kind v) (C_KindApp v)
1615 | _KindApp' = X._KindApp'
1616 |
1617 | _KindVar' :: Prism' (Kind v) (C_KindVar v)
1618 | _KindVar' = X._KindVar'
1619 |
1620 | _KindParen' :: Prism' (Kind v) (C_KindParen v)
1621 | _KindParen' = X._KindParen'
1622 |
1623 | _KindFn' :: Prism' (Kind v) (C_KindFn v)
1624 | _KindFn' = X._KindFn'
1625 |
1626 | _KindStar' :: Prism' (Kind v) (C_KindStar v)
1627 | _KindStar' = X._KindStar'
1628 |
1629 | _Unboxed' :: Prism' Boxed C_Unboxed
1630 | _Unboxed' = X._Unboxed'
1631 |
1632 | _Boxed' :: Prism' Boxed C_Boxed
1633 | _Boxed' = X._Boxed'
1634 |
1635 | _TyQuasiQuote' :: Prism' (Type v) (C_TyQuasiQuote v)
1636 | _TyQuasiQuote' = X._TyQuasiQuote'
1637 |
1638 | _TyWildCard' :: Prism' (Type v) (C_TyWildCard v)
1639 | _TyWildCard' = X._TyWildCard'
1640 |
1641 | _TyBang' :: Prism' (Type v) (C_TyBang v)
1642 | _TyBang' = X._TyBang'
1643 |
1644 | _TySplice' :: Prism' (Type v) (C_TySplice v)
1645 | _TySplice' = X._TySplice'
1646 |
1647 | _TyEquals' :: Prism' (Type v) (C_TyEquals v)
1648 | _TyEquals' = X._TyEquals'
1649 |
1650 | _TyPromoted' :: Prism' (Type v) (C_TyPromoted v)
1651 | _TyPromoted' = X._TyPromoted'
1652 |
1653 | _TyKind' :: Prism' (Type v) (C_TyKind v)
1654 | _TyKind' = X._TyKind'
1655 |
1656 | _TyInfix' :: Prism' (Type v) (C_TyInfix v)
1657 | _TyInfix' = X._TyInfix'
1658 |
1659 | _TyParen' :: Prism' (Type v) (C_TyParen v)
1660 | _TyParen' = X._TyParen'
1661 |
1662 | _TyCon' :: Prism' (Type v) (C_TyCon v)
1663 | _TyCon' = X._TyCon'
1664 |
1665 | _TyVar' :: Prism' (Type v) (C_TyVar v)
1666 | _TyVar' = X._TyVar'
1667 |
1668 | _TyApp' :: Prism' (Type v) (C_TyApp v)
1669 | _TyApp' = X._TyApp'
1670 |
1671 | _TyParArray' :: Prism' (Type v) (C_TyParArray v)
1672 | _TyParArray' = X._TyParArray'
1673 |
1674 | _TyList' :: Prism' (Type v) (C_TyList v)
1675 | _TyList' = X._TyList'
1676 |
1677 | _TyTuple' :: Prism' (Type v) (C_TyTuple v)
1678 | _TyTuple' = X._TyTuple'
1679 |
1680 | _TyFun' :: Prism' (Type v) (C_TyFun v)
1681 | _TyFun' = X._TyFun'
1682 |
1683 | _TyForall' :: Prism' (Type v) (C_TyForall v)
1684 | _TyForall' = X._TyForall'
1685 |
1686 | _WildCardA' :: Prism' (Asst v) (C_WildCardA v)
1687 | _WildCardA' = X._WildCardA'
1688 |
1689 | _ParenA' :: Prism' (Asst v) (C_ParenA v)
1690 | _ParenA' = X._ParenA'
1691 |
1692 | _EqualP' :: Prism' (Asst v) (C_EqualP v)
1693 | _EqualP' = X._EqualP'
1694 |
1695 | _IParam' :: Prism' (Asst v) (C_IParam v)
1696 | _IParam' = X._IParam'
1697 |
1698 | _InfixA' :: Prism' (Asst v) (C_InfixA v)
1699 | _InfixA' = X._InfixA'
1700 |
1701 | _AppA' :: Prism' (Asst v) (C_AppA v)
1702 | _AppA' = X._AppA'
1703 |
1704 | _ClassA' :: Prism' (Asst v) (C_ClassA v)
1705 | _ClassA' = X._ClassA'
1706 |
1707 | _CxEmpty' :: Prism' (Context v) (C_CxEmpty v)
1708 | _CxEmpty' = X._CxEmpty'
1709 |
1710 | _CxTuple' :: Prism' (Context v) (C_CxTuple v)
1711 | _CxTuple' = X._CxTuple'
1712 |
1713 | _CxSingle' :: Prism' (Context v) (C_CxSingle v)
1714 | _CxSingle' = X._CxSingle'
1715 |
1716 | _GuardedRhss' :: Prism' (Rhs v) (C_GuardedRhss v)
1717 | _GuardedRhss' = X._GuardedRhss'
1718 |
1719 | _UnGuardedRhs' :: Prism' (Rhs v) (C_UnGuardedRhs v)
1720 | _UnGuardedRhs' = X._UnGuardedRhs'
1721 |
1722 | _InfixMatch' :: Prism' (Match v) (C_InfixMatch v)
1723 | _InfixMatch' = X._InfixMatch'
1724 |
1725 | _Match' :: Prism' (Match v) (C_Match v)
1726 | _Match' = X._Match'
1727 |
1728 | _NoUnpackPragma' :: Prism' (Unpackedness v) (C_NoUnpackPragma v)
1729 | _NoUnpackPragma' = X._NoUnpackPragma'
1730 |
1731 | _NoUnpack' :: Prism' (Unpackedness v) (C_NoUnpack v)
1732 | _NoUnpack' = X._NoUnpack'
1733 |
1734 | _Unpack' :: Prism' (Unpackedness v) (C_Unpack v)
1735 | _Unpack' = X._Unpack'
1736 |
1737 | _NoStrictAnnot' :: Prism' (BangType v) (C_NoStrictAnnot v)
1738 | _NoStrictAnnot' = X._NoStrictAnnot'
1739 |
1740 | _LazyTy' :: Prism' (BangType v) (C_LazyTy v)
1741 | _LazyTy' = X._LazyTy'
1742 |
1743 | _BangedTy' :: Prism' (BangType v) (C_BangedTy v)
1744 | _BangedTy' = X._BangedTy'
1745 |
1746 | _RecDecl' :: Prism' (ConDecl v) (C_RecDecl v)
1747 | _RecDecl' = X._RecDecl'
1748 |
1749 | _InfixConDecl' :: Prism' (ConDecl v) (C_InfixConDecl v)
1750 | _InfixConDecl' = X._InfixConDecl'
1751 |
1752 | _ConDecl' :: Prism' (ConDecl v) (C_ConDecl v)
1753 | _ConDecl' = X._ConDecl'
1754 |
1755 | _NewType' :: Prism' (DataOrNew v) (C_NewType v)
1756 | _NewType' = X._NewType'
1757 |
1758 | _DataType' :: Prism' (DataOrNew v) (C_DataType v)
1759 | _DataType' = X._DataType'
1760 |
1761 | _InsGData' :: Prism' (InstDecl v) (C_InsGData v)
1762 | _InsGData' = X._InsGData'
1763 |
1764 | _InsData' :: Prism' (InstDecl v) (C_InsData v)
1765 | _InsData' = X._InsData'
1766 |
1767 | _InsType' :: Prism' (InstDecl v) (C_InsType v)
1768 | _InsType' = X._InsType'
1769 |
1770 | _InsDecl' :: Prism' (InstDecl v) (C_InsDecl v)
1771 | _InsDecl' = X._InsDecl'
1772 |
1773 | _ClsDefSig' :: Prism' (ClassDecl v) (C_ClsDefSig v)
1774 | _ClsDefSig' = X._ClsDefSig'
1775 |
1776 | _ClsTyDef' :: Prism' (ClassDecl v) (C_ClsTyDef v)
1777 | _ClsTyDef' = X._ClsTyDef'
1778 |
1779 | _ClsTyFam' :: Prism' (ClassDecl v) (C_ClsTyFam v)
1780 | _ClsTyFam' = X._ClsTyFam'
1781 |
1782 | _ClsDataFam' :: Prism' (ClassDecl v) (C_ClsDataFam v)
1783 | _ClsDataFam' = X._ClsDataFam'
1784 |
1785 | _ClsDecl' :: Prism' (ClassDecl v) (C_ClsDecl v)
1786 | _ClsDecl' = X._ClsDecl'
1787 |
1788 | _TyVarSig' :: Prism' (ResultSig v) (C_TyVarSig v)
1789 | _TyVarSig' = X._TyVarSig'
1790 |
1791 | _KindSig' :: Prism' (ResultSig v) (C_KindSig v)
1792 | _KindSig' = X._KindSig'
1793 |
1794 | _ExplicitBidirectional' :: Prism' (PatternSynDirection v) (C_ExplicitBidirectional v)
1795 | _ExplicitBidirectional' = X._ExplicitBidirectional'
1796 |
1797 | _ImplicitBidirectional' :: Prism' (PatternSynDirection v) (C_ImplicitBidirectional v)
1798 | _ImplicitBidirectional' = X._ImplicitBidirectional'
1799 |
1800 | _Unidirectional' :: Prism' (PatternSynDirection v) (C_Unidirectional v)
1801 | _Unidirectional' = X._Unidirectional'
1802 |
1803 | _IPBinds' :: Prism' (Binds v) (C_IPBinds v)
1804 | _IPBinds' = X._IPBinds'
1805 |
1806 | _BDecls' :: Prism' (Binds v) (C_BDecls v)
1807 | _BDecls' = X._BDecls'
1808 |
1809 | _IHApp' :: Prism' (InstHead v) (C_IHApp v)
1810 | _IHApp' = X._IHApp'
1811 |
1812 | _IHParen' :: Prism' (InstHead v) (C_IHParen v)
1813 | _IHParen' = X._IHParen'
1814 |
1815 | _IHInfix' :: Prism' (InstHead v) (C_IHInfix v)
1816 | _IHInfix' = X._IHInfix'
1817 |
1818 | _IHCon' :: Prism' (InstHead v) (C_IHCon v)
1819 | _IHCon' = X._IHCon'
1820 |
1821 | _IParen' :: Prism' (InstRule v) (C_IParen v)
1822 | _IParen' = X._IParen'
1823 |
1824 | _IRule' :: Prism' (InstRule v) (C_IRule v)
1825 | _IRule' = X._IRule'
1826 |
1827 | _DHApp' :: Prism' (DeclHead v) (C_DHApp v)
1828 | _DHApp' = X._DHApp'
1829 |
1830 | _DHParen' :: Prism' (DeclHead v) (C_DHParen v)
1831 | _DHParen' = X._DHParen'
1832 |
1833 | _DHInfix' :: Prism' (DeclHead v) (C_DHInfix v)
1834 | _DHInfix' = X._DHInfix'
1835 |
1836 | _DHead' :: Prism' (DeclHead v) (C_DHead v)
1837 | _DHead' = X._DHead'
1838 |
1839 | _RoleAnnotDecl' :: Prism' (Decl v) (C_RoleAnnotDecl v)
1840 | _RoleAnnotDecl' = X._RoleAnnotDecl'
1841 |
1842 | _MinimalPragma' :: Prism' (Decl v) (C_MinimalPragma v)
1843 | _MinimalPragma' = X._MinimalPragma'
1844 |
1845 | _AnnPragma' :: Prism' (Decl v) (C_AnnPragma v)
1846 | _AnnPragma' = X._AnnPragma'
1847 |
1848 | _InstSig' :: Prism' (Decl v) (C_InstSig v)
1849 | _InstSig' = X._InstSig'
1850 |
1851 | _SpecInlineSig' :: Prism' (Decl v) (C_SpecInlineSig v)
1852 | _SpecInlineSig' = X._SpecInlineSig'
1853 |
1854 | _SpecSig' :: Prism' (Decl v) (C_SpecSig v)
1855 | _SpecSig' = X._SpecSig'
1856 |
1857 | _InlineConlikeSig' :: Prism' (Decl v) (C_InlineConlikeSig v)
1858 | _InlineConlikeSig' = X._InlineConlikeSig'
1859 |
1860 | _InlineSig' :: Prism' (Decl v) (C_InlineSig v)
1861 | _InlineSig' = X._InlineSig'
1862 |
1863 | _WarnPragmaDecl' :: Prism' (Decl v) (C_WarnPragmaDecl v)
1864 | _WarnPragmaDecl' = X._WarnPragmaDecl'
1865 |
1866 | _DeprPragmaDecl' :: Prism' (Decl v) (C_DeprPragmaDecl v)
1867 | _DeprPragmaDecl' = X._DeprPragmaDecl'
1868 |
1869 | _RulePragmaDecl' :: Prism' (Decl v) (C_RulePragmaDecl v)
1870 | _RulePragmaDecl' = X._RulePragmaDecl'
1871 |
1872 | _ForExp' :: Prism' (Decl v) (C_ForExp v)
1873 | _ForExp' = X._ForExp'
1874 |
1875 | _ForImp' :: Prism' (Decl v) (C_ForImp v)
1876 | _ForImp' = X._ForImp'
1877 |
1878 | _PatSyn' :: Prism' (Decl v) (C_PatSyn v)
1879 | _PatSyn' = X._PatSyn'
1880 |
1881 | _PatBind' :: Prism' (Decl v) (C_PatBind v)
1882 | _PatBind' = X._PatBind'
1883 |
1884 | _FunBind' :: Prism' (Decl v) (C_FunBind v)
1885 | _FunBind' = X._FunBind'
1886 |
1887 | _PatSynSig' :: Prism' (Decl v) (C_PatSynSig v)
1888 | _PatSynSig' = X._PatSynSig'
1889 |
1890 | _TypeSig' :: Prism' (Decl v) (C_TypeSig v)
1891 | _TypeSig' = X._TypeSig'
1892 |
1893 | _SpliceDecl' :: Prism' (Decl v) (C_SpliceDecl v)
1894 | _SpliceDecl' = X._SpliceDecl'
1895 |
1896 | _DefaultDecl' :: Prism' (Decl v) (C_DefaultDecl v)
1897 | _DefaultDecl' = X._DefaultDecl'
1898 |
1899 | _InfixDecl' :: Prism' (Decl v) (C_InfixDecl v)
1900 | _InfixDecl' = X._InfixDecl'
1901 |
1902 | _DerivDecl' :: Prism' (Decl v) (C_DerivDecl v)
1903 | _DerivDecl' = X._DerivDecl'
1904 |
1905 | _InstDecl' :: Prism' (Decl v) (C_InstDecl v)
1906 | _InstDecl' = X._InstDecl'
1907 |
1908 | _ClassDecl' :: Prism' (Decl v) (C_ClassDecl v)
1909 | _ClassDecl' = X._ClassDecl'
1910 |
1911 | _GDataInsDecl' :: Prism' (Decl v) (C_GDataInsDecl v)
1912 | _GDataInsDecl' = X._GDataInsDecl'
1913 |
1914 | _DataInsDecl' :: Prism' (Decl v) (C_DataInsDecl v)
1915 | _DataInsDecl' = X._DataInsDecl'
1916 |
1917 | _TypeInsDecl' :: Prism' (Decl v) (C_TypeInsDecl v)
1918 | _TypeInsDecl' = X._TypeInsDecl'
1919 |
1920 | _DataFamDecl' :: Prism' (Decl v) (C_DataFamDecl v)
1921 | _DataFamDecl' = X._DataFamDecl'
1922 |
1923 | _GDataDecl' :: Prism' (Decl v) (C_GDataDecl v)
1924 | _GDataDecl' = X._GDataDecl'
1925 |
1926 | _DataDecl' :: Prism' (Decl v) (C_DataDecl v)
1927 | _DataDecl' = X._DataDecl'
1928 |
1929 | _ClosedTypeFamDecl' :: Prism' (Decl v) (C_ClosedTypeFamDecl v)
1930 | _ClosedTypeFamDecl' = X._ClosedTypeFamDecl'
1931 |
1932 | _TypeFamDecl' :: Prism' (Decl v) (C_TypeFamDecl v)
1933 | _TypeFamDecl' = X._TypeFamDecl'
1934 |
1935 | _TypeDecl' :: Prism' (Decl v) (C_TypeDecl v)
1936 | _TypeDecl' = X._TypeDecl'
1937 |
1938 | _PatternNamespace' :: Prism' (Namespace v) (C_PatternNamespace v)
1939 | _PatternNamespace' = X._PatternNamespace'
1940 |
1941 | _TypeNamespace' :: Prism' (Namespace v) (C_TypeNamespace v)
1942 | _TypeNamespace' = X._TypeNamespace'
1943 |
1944 | _NoNamespace' :: Prism' (Namespace v) (C_NoNamespace v)
1945 | _NoNamespace' = X._NoNamespace'
1946 |
1947 | _AssocRight' :: Prism' (Assoc v) (C_AssocRight v)
1948 | _AssocRight' = X._AssocRight'
1949 |
1950 | _AssocLeft' :: Prism' (Assoc v) (C_AssocLeft v)
1951 | _AssocLeft' = X._AssocLeft'
1952 |
1953 | _AssocNone' :: Prism' (Assoc v) (C_AssocNone v)
1954 | _AssocNone' = X._AssocNone'
1955 |
1956 | _IThingWith' :: Prism' (ImportSpec v) (C_IThingWith v)
1957 | _IThingWith' = X._IThingWith'
1958 |
1959 | _IThingAll' :: Prism' (ImportSpec v) (C_IThingAll v)
1960 | _IThingAll' = X._IThingAll'
1961 |
1962 | _IAbs' :: Prism' (ImportSpec v) (C_IAbs v)
1963 | _IAbs' = X._IAbs'
1964 |
1965 | _IVar' :: Prism' (ImportSpec v) (C_IVar v)
1966 | _IVar' = X._IVar'
1967 |
1968 | _EWildcard' :: Prism' (EWildcard v) (C_EWildcard v)
1969 | _EWildcard' = X._EWildcard'
1970 |
1971 | _NoWildcard' :: Prism' (EWildcard v) (C_NoWildcard v)
1972 | _NoWildcard' = X._NoWildcard'
1973 |
1974 | _EModuleContents' :: Prism' (ExportSpec v) (C_EModuleContents v)
1975 | _EModuleContents' = X._EModuleContents'
1976 |
1977 | _EThingWith' :: Prism' (ExportSpec v) (C_EThingWith v)
1978 | _EThingWith' = X._EThingWith'
1979 |
1980 | _EAbs' :: Prism' (ExportSpec v) (C_EAbs v)
1981 | _EAbs' = X._EAbs'
1982 |
1983 | _EVar' :: Prism' (ExportSpec v) (C_EVar v)
1984 | _EVar' = X._EVar'
1985 |
1986 | _WarnText' :: Prism' (WarningText v) (C_WarnText v)
1987 | _WarnText' = X._WarnText'
1988 |
1989 | _DeprText' :: Prism' (WarningText v) (C_DeprText v)
1990 | _DeprText' = X._DeprText'
1991 |
1992 | _XmlHybrid' :: Prism' (Module v) (C_XmlHybrid v)
1993 | _XmlHybrid' = X._XmlHybrid'
1994 |
1995 | _XmlPage' :: Prism' (Module v) (C_XmlPage v)
1996 | _XmlPage' = X._XmlPage'
1997 |
1998 | _Module' :: Prism' (Module v) (C_Module v)
1999 | _Module' = X._Module'
2000 |
2001 | _Rule :: Iso'
2002 | ( Rule SrcSpanInfo )
2003 | ( SrcSpanInfo, String, Maybe (Activation SrcSpanInfo)
2004 | , Maybe [RuleVar SrcSpanInfo], Exp SrcSpanInfo, Exp SrcSpanInfo
2005 | )
2006 | _Rule = X._Rule
2007 |
2008 | _Incoherent :: Prism' (Overlap SrcSpanInfo) SrcSpanInfo
2009 | _Incoherent = X._Incoherent
2010 |
2011 | _ModuleName :: Iso' (ModuleName SrcSpanInfo) (SrcSpanInfo, String)
2012 | _ModuleName = X._ModuleName
2013 |
2014 | _PXAttr :: Iso'
2015 | (PXAttr SrcSpanInfo)
2016 | (SrcSpanInfo, XName SrcSpanInfo, Pat SrcSpanInfo)
2017 | _PXAttr = X._PXAttr
2018 |
2019 | _XAttr :: Iso'
2020 | (XAttr SrcSpanInfo)
2021 | (SrcSpanInfo, XName SrcSpanInfo, Exp SrcSpanInfo)
2022 | _XAttr = X._XAttr
2023 |
2024 | _Alt :: Iso'
2025 | (Alt SrcSpanInfo)
2026 | (SrcSpanInfo, Pat SrcSpanInfo, Rhs SrcSpanInfo, Maybe (Binds SrcSpanInfo))
2027 | _Alt = X._Alt
2028 |
2029 | _TypeEqn :: Iso'
2030 | (TypeEqn SrcSpanInfo)
2031 | (SrcSpanInfo, Type SrcSpanInfo, Type SrcSpanInfo)
2032 | _TypeEqn = X._TypeEqn
2033 |
2034 | _FunDep :: Iso' (FunDep SrcSpanInfo) (SrcSpanInfo, [Name SrcSpanInfo], [Name SrcSpanInfo])
2035 | _FunDep = X._FunDep
2036 |
2037 | _GuardedRhs :: Iso' (GuardedRhs SrcSpanInfo) (SrcSpanInfo, [Stmt SrcSpanInfo], Exp SrcSpanInfo)
2038 | _GuardedRhs = X._GuardedRhs
2039 |
2040 | _GadtDecl :: Iso' (GadtDecl SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, Maybe [FieldDecl SrcSpanInfo], Type SrcSpanInfo)
2041 | _GadtDecl = X._GadtDecl
2042 |
2043 | _QualConDecl :: Iso'
2044 | (QualConDecl SrcSpanInfo)
2045 | (SrcSpanInfo, Maybe [TyVarBind SrcSpanInfo], Maybe (Context SrcSpanInfo), ConDecl SrcSpanInfo)
2046 | _QualConDecl = X._QualConDecl
2047 |
2048 | _FieldDecl :: Iso' (FieldDecl SrcSpanInfo) (SrcSpanInfo, [Name SrcSpanInfo], Type SrcSpanInfo)
2049 | _FieldDecl = X._FieldDecl
2050 |
2051 | _Deriving :: Iso' (Deriving SrcSpanInfo) (SrcSpanInfo, [InstRule SrcSpanInfo])
2052 | _Deriving = X._Deriving
2053 |
2054 | _InjectivityInfo :: Iso' (InjectivityInfo SrcSpanInfo) (SrcSpanInfo, Name SrcSpanInfo, [Name SrcSpanInfo])
2055 | _InjectivityInfo = X._InjectivityInfo
2056 |
2057 | _ExplicitBidirectional :: Prism' (PatternSynDirection SrcSpanInfo) (SrcSpanInfo, [Decl SrcSpanInfo])
2058 | _ExplicitBidirectional = X._ExplicitBidirectional
2059 |
2060 | _IPBind :: Iso' (IPBind SrcSpanInfo) (SrcSpanInfo, IPName SrcSpanInfo, Exp SrcSpanInfo)
2061 | _IPBind = X._IPBind
2062 |
2063 | _ImportSpecList :: Iso' (ImportSpecList SrcSpanInfo) (SrcSpanInfo, Bool, [ImportSpec SrcSpanInfo])
2064 | _ImportSpecList = X._ImportSpecList
2065 |
2066 | _ImportDecl :: Iso'
2067 | ( ImportDecl SrcSpanInfo )
2068 | ( SrcSpanInfo, ModuleName SrcSpanInfo, Bool, Bool, Bool, Maybe String, Maybe (ModuleName SrcSpanInfo)
2069 | , Maybe (ImportSpecList SrcSpanInfo)
2070 | )
2071 | _ImportDecl = X._ImportDecl
2072 |
2073 | _ExportSpecList :: Iso' (ExportSpecList SrcSpanInfo) (SrcSpanInfo, [ExportSpec SrcSpanInfo])
2074 | _ExportSpecList = X._ExportSpecList
2075 |
2076 | _ModuleHead :: Iso'
2077 | (ModuleHead SrcSpanInfo)
2078 | (SrcSpanInfo, ModuleName SrcSpanInfo, Maybe (WarningText SrcSpanInfo), Maybe (ExportSpecList SrcSpanInfo))
2079 | _ModuleHead = X._ModuleHead
2080 |
--------------------------------------------------------------------------------
/src/X/Language/Haskell/Exts/Prisms/Types.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module X.Language.Haskell.Exts.Prisms.Types ( module Exports ) where
4 |
5 | import Language.Haskell.Exts.Prisms as Exports ( C_ActiveFrom(..)
6 | , C_ActiveUntil(..)
7 | , C_AndFormula(..)
8 | , C_Ann(..)
9 | , C_AnnModulePragma(..)
10 | , C_AnnPragma(..)
11 | , C_App(..)
12 | , C_AppA(..)
13 | , C_AssocLeft(..)
14 | , C_AssocNone(..)
15 | , C_AssocRight(..)
16 | , C_BDecls(..)
17 | , C_BangedTy(..)
18 | , C_Boxed(..)
19 | , C_BracketExp(..)
20 | , C_CApi(..)
21 | , C_CCall(..)
22 | , C_CPlusPlus(..)
23 | , C_Case(..)
24 | , C_Char(..)
25 | , C_ClassA(..)
26 | , C_ClassDecl(..)
27 | , C_ClosedTypeFamDecl(..)
28 | , C_ClsDataFam(..)
29 | , C_ClsDecl(..)
30 | , C_ClsDefSig(..)
31 | , C_ClsTyDef(..)
32 | , C_ClsTyFam(..)
33 | , C_Con(..)
34 | , C_ConDecl(..)
35 | , C_ConName(..)
36 | , C_ConOp(..)
37 | , C_Cons(..)
38 | , C_CorePragma(..)
39 | , C_CxEmpty(..)
40 | , C_CxSingle(..)
41 | , C_CxTuple(..)
42 | , C_DHApp(..)
43 | , C_DHInfix(..)
44 | , C_DHParen(..)
45 | , C_DHead(..)
46 | , C_DataDecl(..)
47 | , C_DataFamDecl(..)
48 | , C_DataInsDecl(..)
49 | , C_DataType(..)
50 | , C_DeclBracket(..)
51 | , C_DefaultDecl(..)
52 | , C_DeprPragmaDecl(..)
53 | , C_DeprText(..)
54 | , C_DeprText(..)
55 | , C_DerivDecl(..)
56 | , C_Do(..)
57 | , C_DotNet(..)
58 | , C_EAbs(..)
59 | , C_EModuleContents(..)
60 | , C_EThingWith(..)
61 | , C_EVar(..)
62 | , C_EWildcard(..)
63 | , C_EnumFrom(..)
64 | , C_EnumFromThen(..)
65 | , C_EnumFromThenTo(..)
66 | , C_EnumFromTo(..)
67 | , C_EqualP(..)
68 | , C_ExpBracket(..)
69 | , C_ExpTypeSig(..)
70 | , C_ExplicitBidirectional(..)
71 | , C_ExprHole(..)
72 | , C_FieldPun(..)
73 | , C_FieldUpdate(..)
74 | , C_FieldWildcard(..)
75 | , C_ForExp(..)
76 | , C_ForImp(..)
77 | , C_Frac(..)
78 | , C_FunBind(..)
79 | , C_FunCon(..)
80 | , C_GDataDecl(..)
81 | , C_GDataInsDecl(..)
82 | , C_GHC(..)
83 | , C_GenPragma(..)
84 | , C_Generator(..)
85 | , C_GroupBy(..)
86 | , C_GroupByUsing(..)
87 | , C_GroupUsing(..)
88 | , C_GuardedRhss(..)
89 | , C_HADDOCK(..)
90 | , C_HUGS(..)
91 | , C_IAbs(..)
92 | , C_IHApp(..)
93 | , C_IHCon(..)
94 | , C_IHInfix(..)
95 | , C_IHParen(..)
96 | , C_IPBinds(..)
97 | , C_IPDup(..)
98 | , C_IPLin(..)
99 | , C_IPVar(..)
100 | , C_IParam(..)
101 | , C_IParen(..)
102 | , C_IRule(..)
103 | , C_IThingAll(..)
104 | , C_IThingWith(..)
105 | , C_IVar(..)
106 | , C_IdSplice(..)
107 | , C_Ident(..)
108 | , C_If(..)
109 | , C_ImplicitBidirectional(..)
110 | , C_Incoherent(..)
111 | , C_InfixA(..)
112 | , C_InfixApp(..)
113 | , C_InfixConDecl(..)
114 | , C_InfixDecl(..)
115 | , C_InfixMatch(..)
116 | , C_InlineConlikeSig(..)
117 | , C_InlineSig(..)
118 | , C_InsData(..)
119 | , C_InsDecl(..)
120 | , C_InsGData(..)
121 | , C_InsType(..)
122 | , C_InstDecl(..)
123 | , C_InstSig(..)
124 | , C_Int(..)
125 | , C_JavaScript(..)
126 | , C_Js(..)
127 | , C_Jvm(..)
128 | , C_KindApp(..)
129 | , C_KindFn(..)
130 | , C_KindList(..)
131 | , C_KindParen(..)
132 | , C_KindSig(..)
133 | , C_KindStar(..)
134 | , C_KindTuple(..)
135 | , C_KindVar(..)
136 | , C_KindedVar(..)
137 | , C_LCase(..)
138 | , C_Lambda(..)
139 | , C_LanguagePragma(..)
140 | , C_LazyTy(..)
141 | , C_LeftArrApp(..)
142 | , C_LeftArrHighApp(..)
143 | , C_LeftSection(..)
144 | , C_Let(..)
145 | , C_LetStmt(..)
146 | , C_List(..)
147 | , C_ListComp(..)
148 | , C_ListCon(..)
149 | , C_Lit(..)
150 | , C_MDo(..)
151 | , C_Match(..)
152 | , C_MinimalPragma(..)
153 | , C_Module(..)
154 | , C_ModuleAnn(..)
155 | , C_MultiIf(..)
156 | , C_NHC98(..)
157 | , C_NegApp(..)
158 | , C_Negative(..)
159 | , C_NewType(..)
160 | , C_NoNamespace(..)
161 | , C_NoOverlap(..)
162 | , C_NoStrictAnnot(..)
163 | , C_NoUnpack(..)
164 | , C_NoUnpackPragma(..)
165 | , C_NoWildcard(..)
166 | , C_Nominal(..)
167 | , C_OptionsPragma(..)
168 | , C_OrFormula(..)
169 | , C_Overlap(..)
170 | , C_OverloadedLabel(..)
171 | , C_PApp(..)
172 | , C_PAsPat(..)
173 | , C_PBangPat(..)
174 | , C_PFieldPat(..)
175 | , C_PFieldPun(..)
176 | , C_PFieldWildcard(..)
177 | , C_PInfixApp(..)
178 | , C_PIrrPat(..)
179 | , C_PList(..)
180 | , C_PLit(..)
181 | , C_PNPlusK(..)
182 | , C_PParen(..)
183 | , C_PQuasiQuote(..)
184 | , C_PRPat(..)
185 | , C_PRec(..)
186 | , C_PTuple(..)
187 | , C_PVar(..)
188 | , C_PViewPat(..)
189 | , C_PWildCard(..)
190 | , C_PXETag(..)
191 | , C_PXPatTag(..)
192 | , C_PXPcdata(..)
193 | , C_PXRPats(..)
194 | , C_PXTag(..)
195 | , C_ParArray(..)
196 | , C_ParArrayComp(..)
197 | , C_ParArrayFromThenTo(..)
198 | , C_ParArrayFromTo(..)
199 | , C_ParComp(..)
200 | , C_Paren(..)
201 | , C_ParenA(..)
202 | , C_ParenFormula(..)
203 | , C_ParenSplice(..)
204 | , C_PatBind(..)
205 | , C_PatBracket(..)
206 | , C_PatSyn(..)
207 | , C_PatSynSig(..)
208 | , C_PatTypeSig(..)
209 | , C_PatternNamespace(..)
210 | , C_Phantom(..)
211 | , C_PlayInterruptible(..)
212 | , C_PlayRisky(..)
213 | , C_PlaySafe(..)
214 | , C_PrimChar(..)
215 | , C_PrimDouble(..)
216 | , C_PrimFloat(..)
217 | , C_PrimInt(..)
218 | , C_PrimString(..)
219 | , C_PrimWord(..)
220 | , C_Proc(..)
221 | , C_PromotedCon(..)
222 | , C_PromotedInteger(..)
223 | , C_PromotedList(..)
224 | , C_PromotedString(..)
225 | , C_PromotedTuple(..)
226 | , C_PromotedUnit(..)
227 | , C_QConOp(..)
228 | , C_QVarOp(..)
229 | , C_Qual(..)
230 | , C_QualStmt(..)
231 | , C_Qualifier(..)
232 | , C_QuasiQuote(..)
233 | , C_RPAs(..)
234 | , C_RPCAs(..)
235 | , C_RPEither(..)
236 | , C_RPGuard(..)
237 | , C_RPOp(..)
238 | , C_RPOpt(..)
239 | , C_RPOptG(..)
240 | , C_RPParen(..)
241 | , C_RPPat(..)
242 | , C_RPPlus(..)
243 | , C_RPPlusG(..)
244 | , C_RPSeq(..)
245 | , C_RPStar(..)
246 | , C_RPStarG(..)
247 | , C_RecConstr(..)
248 | , C_RecDecl(..)
249 | , C_RecStmt(..)
250 | , C_RecUpdate(..)
251 | , C_Representational(..)
252 | , C_RightArrApp(..)
253 | , C_RightArrHighApp(..)
254 | , C_RightSection(..)
255 | , C_RoleAnnotDecl(..)
256 | , C_RoleWildcard(..)
257 | , C_RulePragmaDecl(..)
258 | , C_RuleVar(..)
259 | , C_SCCPragma(..)
260 | , C_Signless(..)
261 | , C_SpecInlineSig(..)
262 | , C_SpecSig(..)
263 | , C_Special(..)
264 | , C_SpliceDecl(..)
265 | , C_SpliceExp(..)
266 | , C_StdCall(..)
267 | , C_String(..)
268 | , C_Symbol(..)
269 | , C_ThenBy(..)
270 | , C_ThenTrans(..)
271 | , C_Tuple(..)
272 | , C_TupleCon(..)
273 | , C_TupleSection(..)
274 | , C_TyApp(..)
275 | , C_TyBang(..)
276 | , C_TyCon(..)
277 | , C_TyEquals(..)
278 | , C_TyForall(..)
279 | , C_TyFun(..)
280 | , C_TyInfix(..)
281 | , C_TyKind(..)
282 | , C_TyList(..)
283 | , C_TyParArray(..)
284 | , C_TyParen(..)
285 | , C_TyPromoted(..)
286 | , C_TyQuasiQuote(..)
287 | , C_TySplice(..)
288 | , C_TyTuple(..)
289 | , C_TyVar(..)
290 | , C_TyVarSig(..)
291 | , C_TyWildCard(..)
292 | , C_TypQuote(..)
293 | , C_TypeAnn(..)
294 | , C_TypeApp(..)
295 | , C_TypeBracket(..)
296 | , C_TypeDecl(..)
297 | , C_TypeDecl(..)
298 | , C_TypeFamDecl(..)
299 | , C_TypeInsDecl(..)
300 | , C_TypeNamespace(..)
301 | , C_TypeSig(..)
302 | , C_TypedRuleVar(..)
303 | , C_UnGuardedRhs(..)
304 | , C_UnQual(..)
305 | , C_Unboxed(..)
306 | , C_UnboxedSingleCon(..)
307 | , C_Unidirectional(..)
308 | , C_UnitCon(..)
309 | , C_UnkindedVar(..)
310 | , C_UnknownTool(..)
311 | , C_Unpack(..)
312 | , C_Var(..)
313 | , C_VarFormula(..)
314 | , C_VarName(..)
315 | , C_VarOp(..)
316 | , C_VarQuote(..)
317 | , C_WarnPragmaDecl(..)
318 | , C_WarnText(..)
319 | , C_WarnText(..)
320 | , C_WildCardA(..)
321 | , C_XChildTag(..)
322 | , C_XDomName(..)
323 | , C_XETag(..)
324 | , C_XExpTag(..)
325 | , C_XName(..)
326 | , C_XPcdata(..)
327 | , C_XTag(..)
328 | , C_XmlHybrid(..)
329 | , C_XmlPage(..)
330 | , C_YHC(..)
331 | )
332 |
333 |
--------------------------------------------------------------------------------
/src/X/Language/Haskell/Interpreter.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 | {-# LANGUAGE OverloadedStrings #-}
3 |
4 | module X.Language.Haskell.Interpreter
5 | ( module Language.Haskell.Interpreter
6 | , build
7 | ) where
8 |
9 | import Refactorio.Prelude hiding ( get )
10 |
11 | import Language.Haskell.Interpreter
12 | import System.Directory ( getHomeDirectory )
13 |
14 | build :: Typeable a => [String] -> Text -> IO (Either InterpreterError a)
15 | build possiblePreludes src = getHomeDirectory >>= \home -> runInterpreter $ do
16 | -- TODO: make extensions CLI options
17 | set [ languageExtensions
18 | := [ AllowAmbiguousTypes
19 | , FlexibleContexts
20 | , FlexibleInstances
21 | , GADTs
22 | , FunctionalDependencies
23 | , MultiParamTypeClasses
24 | , NoImplicitPrelude
25 | , LambdaCase
26 | , OverloadedStrings
27 | , QuasiQuotes
28 | , RecordWildCards
29 | , ScopedTypeVariables
30 | , TupleSections
31 | , TypeApplications
32 | ]
33 | ]
34 | -- TODO: allow setting via CLI
35 | -- TODO: should we include '.'? probably not?
36 | set [ searchPath := [ home <> "/src/refactorio/.stack-work/install/x86_64-osx/lts-9.21/8.0.2/pkgdb" ] ]
37 | -- TODO: catch errors and try the rest.
38 | setImportsQ hardcodedImports
39 | interpret (unpack ("(" <> src <> ")")) infer
40 | where
41 | preludeImport = maybe [] importPrelude . head $ possiblePreludes
42 |
43 | hardcodedImports =
44 | [ ("Codec.Compression.Zlib.Lens" , Just "Z")
45 | , ("Control.Lens" , Just "L")
46 | , ("Data.Char" , Just "Char")
47 | , ("Data.List.Lens" , Just "L")
48 | , ("Data.List.Lens" , Just "ListL")
49 | , ("Data.String" , Just "S")
50 | , ("Data.String" , Just "String")
51 | , ("Data.Text" , Just "Text")
52 | , ("Data.Text" , Just "T")
53 | , ("Data.Text.Lens" , Just "Text")
54 | , ("Data.Text.Lens" , Just "T")
55 | , ("Data.Aeson.Lens" , Just "J")
56 | , ("Data.ByteString" , Just "BS")
57 | , ("Data.ByteString.Lazy" , Just "LBS")
58 | , ("Data.String.Conv" , Just "S")
59 | , ("Language.Haskell.Exts" , Just "HS")
60 | , ("Language.Haskell.Exts.Prisms", Just "HS")
61 | , ("Prelude" , Just "Prelude")
62 | , ("Refactorio.Helpers" , Just "H")
63 | , ("Refactorio.Helpers" , Just "Helpers")
64 | , ("Refactorio.Prelude" , Just "RP")
65 | , ("Safe" , Just "Safe")
66 | , ("Text.Pandoc.Lens" , Just "P")
67 | , ("Text.Pandoc.Lens" , Just "Pandoc")
68 | , ("Text.Regex.Lens" , Just "R")
69 | , ("Text.Regex.Lens" , Just "Regex")
70 | , ("Text.Regex.Quote" , Nothing) -- The only unqualified exception
71 | , ("Text.Taggy.Lens" , Just "Html")
72 | , ("Text.Taggy.Lens" , Just "H")
73 | , ("Text.Xml.Lens" , Just "Xml")
74 | , ("Text.Xml.Lens" , Just "XC")
75 | , ("Text.XML.Lens" , Just "XML")
76 | , ("Text.XML.Lens" , Just "X")
77 | , ("Text.XML.Hexml.Lens" , Just "HX")
78 | , ("Text.XML.Hexml.Lens" , Just "Hexml")
79 | , ("Text.XML.Expat.Lens" , Just "Expat")
80 | , ("Text.XML.Expat.Lens" , Just "EX")
81 | ] ++ preludeImport
82 |
83 | importPrelude :: String -> [(String, Maybe String)]
84 | importPrelude s = [(s, Nothing)]
85 |
--------------------------------------------------------------------------------
/src/X/Rainbow.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module X.Rainbow
4 | ( module Exports
5 | , Chunk'
6 | , putChunks
7 | , putChunksLn
8 | ) where
9 |
10 | import Refactorio.Prelude
11 |
12 | import Rainbow as Exports
13 |
14 | type Chunk' = Chunk Text
15 |
16 | putChunks :: Renderable a => [Chunk a] -> IO ()
17 | putChunks = mapM_ putStr . chunksToByteStrings toByteStringsColors256
18 |
19 | putChunksLn :: Renderable a => [Chunk a] -> IO ()
20 | putChunksLn cs = putChunks cs >> nl
21 |
--------------------------------------------------------------------------------
/src/X/Streaming.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 |
3 | module X.Streaming
4 | ( module Streaming
5 | , concatStreams
6 | ) where
7 |
8 | import Refactorio.Prelude
9 |
10 | import Streaming
11 |
12 | concatStreams :: Monad m => [Stream (Of a) m ()] -> Stream (Of a) m ()
13 | concatStreams = foldl f z
14 | where
15 | f x y = x >>= const y
16 | z = return ()
17 |
--------------------------------------------------------------------------------
/src/X/Streaming/Files.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE NoImplicitPrelude #-}
2 | {-# LANGUAGE OverloadedStrings #-}
3 |
4 | module X.Streaming.Files
5 | ( FileInfo
6 | , FileStatus
7 | , tree
8 | ) where
9 |
10 | import Refactorio.Prelude
11 | import qualified Streaming.Prelude as S
12 |
13 | import Streaming
14 | import System.Directory
15 | import System.Posix.Files
16 | import System.Posix.Types ( Fd( Fd ) )
17 |
18 | type FileInfo = (FilePath, FileStatus)
19 |
20 | tree :: MonadIO m => FilePath -> Stream (Of FileInfo) m ()
21 | tree "-" = do
22 | stat <- liftIO $ getFdStatus (Fd 0)
23 | S.yield ("-", stat)
24 | tree path = do
25 | pathStat <- liftIO $ getFileStatus path
26 | let selfStream = S.yield (path, pathStat)
27 | if not (isDirectory pathStat)
28 | then selfStream
29 | else do
30 | children <- concatStreams . map (tree . ((path ++ "/") ++)) . sort
31 | <$> liftIO (listDirectory path)
32 | selfStream >> children
33 |
34 | concatStreams :: Monad m => [Stream (Of a) m ()] -> Stream (Of a) m ()
35 | concatStreams = foldl f z
36 | where
37 | f x y = x >>= const y
38 | z = return ()
39 |
--------------------------------------------------------------------------------
/stack.yaml:
--------------------------------------------------------------------------------
1 | resolver: lts-9.21
2 |
3 | packages:
4 | - location: .
5 | - location:
6 | git: git@github.com:SuperpowersCorp/language-c-optics.git
7 | commit: d0516661d7360a42f23621e2ef8a251246057b6e
8 | extra-dep: true
9 | - location:
10 | git: git@github.com:SuperpowersCorp/language-javascript-optics.git
11 | commit: 2fe765a91f0b3ac8516ab5998d12254b33218872
12 | extra-dep: true
13 |
14 | allow-newer: true
15 |
16 | extra-deps:
17 | - Cabal-2.0.0.2
18 | - aeson-lens-0.5.0.0
19 | - haskell-src-exts-prisms-1.18.2.0
20 | - hexml-lens-0.2.1
21 | - hexpat-lens-0.1.7
22 | - hexpat-tagsoup-0.1
23 | - hierarchy-0.3.1.4
24 | - io-capture-1.0.0
25 | - lens-4.15.4
26 | - mueval-0.9.3
27 | - number-show-0.1.0.0
28 | - pandoc-lens-0.6.3
29 | - pipes-4.3.9
30 | - pipes-files-0.1.2
31 | - protolude-0.2.1
32 | - show-0.6
33 | - taggy-0.2.1
34 | - taggy-lens-0.1.2
35 | - xml-html-conduit-lens-0.3.2.3
36 |
--------------------------------------------------------------------------------
/test/Spec.hs:
--------------------------------------------------------------------------------
1 | {-# OPTIONS_GHC -F -pgmF hspec-discover #-}
2 |
--------------------------------------------------------------------------------