1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00
semantic/app/Haskell.hs
2015-12-15 15:08:49 -05:00

18 lines
485 B
Haskell

module Haskell where
import Diff
import Range
import Syntax
import Term
import Control.Comonad.Cofree
import Text.Parsec
import Text.Parsec.String
haskellParser :: Parser (Term String Info)
haskellParser = toTerm <$> many anyChar
where toTerm a = Info (Range 0 0) mempty :< Leaf a
runHaskellParser :: String -> IO (Term String Info)
runHaskellParser input = return . either errorToTerm id $ parse haskellParser "" input
where errorToTerm _ = Info (Range 0 0) mempty :< Leaf "_"