-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I think this utility is pretty useful since it means you can run GHCi scripts quickly.
The core functionality should be:
- Wrap all code blocks (blocks separated by empty lines) in
:{...:} - Separate declaration from usage
- Top level I/O actions, groups of imports, and template Haskell should be in their own blocks.
- Group ghci directives together.
- It should contain some default extensions (overloaded strings, type applications, maybe template Haskell etc).
1) Separate declaration from usage
x = 5
print xShould be:
:{
x = 5
:}
:{
print x
:}2) Separate I/O action
x <- pure 5
print xShould be:
:{
x <- pure 5
:}
:{
print x
:}3) Group signature and bindings
f :: Int -> Int
f x = x + 1
print (f 5)Should be:
:{
f :: Int -> Int
f x = x + 1
:}
:{
print (f 5)
:}3) Separate imports
import Data.List
ys = sort [5,4,3,2,1]
print (f 5)Should be:
:{
import Data.List
:}
:{
ys = sort [5,4,3,2,1]
:}
:{
print ys
:}4) Template Haskell splices should converted to GHCi template haskell format.
$(F.declareColumns df)
print (df |> D.filterWhere (x .> 5))Should be:
-- include template haskell extension since we know it's in the script.
:{
:set -XTemplateHaskell
:}
:{
_ = (); F.declareColumns df
:}
:{
print (df |> D.filterWhere (x .> 5))
:}5) Group GHCI directives (or have them in their own blocks if t.
:set -XScopedTYpeVariables
:set -XOverloadedLabels
print 4Should be:
:{
:set -XScopedTYpeVariables
:}
:{
:set -XOverloadedLabels
:}
:{
print 4
:}Metadata
Metadata
Assignees
Labels
No labels