Three Haskell Summer of Code 2018 proposals share an underlying theme - extracting information about Haskell source from GHC.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies, DataKinds, TypeInType, KindSignatures, TypeOperators, TypeApplications, StandaloneDeriving, ApplicativeDo, GeneralizedNewtypeDeriving #-} | |
import GHC.Types | |
import Data.Monoid | |
import Control.Monad.Trans.Maybe | |
import Control.Monad.Trans.Writer | |
import Control.Monad.Trans | |
data FieldStatus = Error | Normal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2017-06-10 22:48:34 [ThreadId 9] - <--2--{"result":[{"arguments":[{"file":{"textDocument":{"uri":"file:///home/zubin/haskell-ide-engine/test/testdata/ApplyRefact.hs"}}},{"start_pos":{"position":{"line":3,"character":8}}}],"title":"Apply hint:Redundant bracket","command":"applyrefact:applyOne"}],"jsonrpc":"2.0","id":3} | |
2017-06-10 22:48:36 [ThreadId 7] - ---> {"jsonrpc":"2.0","id":4,"method":"workspace/executeCommand","params":{"command":"applyrefact:applyOne","arguments":[{"file":{"textDocument":{"uri":"file:///home/zubin/haskell-ide-engine/test/testdata/ApplyRefact.hs"}}},{"start_pos":{"position":{"line":3,"character":8}}}]}} | |
2017-06-10 22:48:36 [ThreadId 10] - reactor:got ExecuteCommandRequest:RequestMessage {_jsonrpc = "2.0", _id = IdInt 4, _method = WorkspaceExecuteCommand, _params = ExecuteCommandParams {_command = "applyrefact:applyOne", _arguments = Just (List [Object (fromList [("file",Object (fromList [("textDocument",Object (fromList [("uri",String "file:///home/zubin/haskell-ide-engine/test/testdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE OverlappingInstances #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
type Value = String | |
type FromJSON = Read | |
fromJSON :: FromJSON a => Value -> a | |
fromJSON = read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018-02-13 23:57:02 wz1000 alanz, alexbiehl, mpickering: https://gist.github.com/wz1000/81e0bb720237e8ae6193c7ac2d28c913 | |
2018-02-13 23:58:15 alanz wz1000, I like what you are aiming for | |
2018-02-13 23:58:22 alanz well, all of you | |
2018-02-13 23:58:23 mpickering wz1000: I just skimmed it now but if I were you I would write down something very concrete (answer all the questions at the end) | |
2018-02-13 23:58:33 alanz I guess I should actually pay some attention | |
2018-02-13 23:59:01 mpickering if you don't write down something very concrete then making progress is much more difficult as people love discussing things until they die | |
2018-02-13 23:59:47 wz1000 yeah, this is just some initial brainstorming | |
2018-02-14 00:00:03 c_wraith I'd love to be able to get more information out of ghc | |
2018-02-14 00:00:36 alanz I think there are also two parts to it, getting the info out, and keeping it available, as in storing it on disk or some such | |
2018-02-14 00:01:09 alanz Because expecting a big project's detail to be in RAM won' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data HieToken = HieToken | |
{ htkInfo :: TokenType | |
, htkSpan :: Span | |
, htkDetails :: Maybe TokenDetails | |
, htkType :: Maybe TypeIndex | |
} | |
data HieAST = | |
Leaf HieToken | |
| Node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main :: IO () | |
main = | |
do code <- getContents | |
args <- getArgs | |
case consume options (map T.pack args) of | |
Succeeded (action,typ,exts) -> | |
outputWith action typ exts code | |
_ -> | |
error (T.unpack (textDescription (describe options []))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main :: IO () | |
main = print $ fib 41 where | |
fib :: Int -> Int | |
fib 0 = 0 | |
fib 1 = 1 | |
fib n = fib (n-1) + fib (n-2) | |
Node {nodeInfo = ["Module"], nodeSpan = SrcSpanPoint "" 1 1, nodeChildren = | |
[Leaf (HieToken {htkInfo = TkIdentifier, htkSpan = SrcSpanOneLine "/home/zubin/Documents/Haskell/Fib.hs" 1 1 5, htkDetails = Nothing, htkType = Nothing}) | |
,Leaf (HieToken {htkInfo = TkSpace, htkSpan = SrcSpanOneLine "/home/zubin/Documents/Haskell/Fib.hs" 1 5 6 , htkDetails = Nothing, htkType = Nothing}) | |
,Leaf (HieToken {htkInfo = TkGlyph, htkSpan = SrcSpanOneLine "/home/zubin/Documents/Haskell/Fib.hs" 1 6 8, htkDetails = Nothing, htkType = Nothing}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class C a where | |
f :: a -> Int | |
f = const 3 | |
main :: IO () | |
main = print $ fib 41 where | |
fib :: Int -> Int | |
fib 0 = 0 | |
fib 1 = 1 | |
fib n = fib (n-1) + fib (n-2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A where | |
data D = D | |
{ foo :: Int | |
, bar :: Bool | |
} | |
[1 of 1] Compiling A ( a.hs, nothing ) | |
a.hs:1:1: | |
==================== Typechecker ==================== |
OlderNewer