Skip to content

Commit

Permalink
Mess with imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Grant Jeffries committed Nov 4, 2019
1 parent 47f9a76 commit 2b5b6ee
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
28 changes: 14 additions & 14 deletions bowtie-blueprint/src/Bowtie/Blueprint.hs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
module Bowtie.Blueprint where

import Bowtie.Lib.Prelude
import Bowtie.Type.AST (Type, TypeDeclaration)

import qualified Bowtie.Type.AST as Type.AST
import qualified Bowtie.Type.Parse as Type.Parse
import qualified Bowtie.Type.Parse as Parse
import qualified CMark
import qualified Data.HashMap.Strict as HashMap
import qualified Data.Text as Text
import qualified Text.Megaparsec as Mega
import qualified Text.Megaparsec.Char.Lexer as Lexer

data Blueprint
= Blueprint (HashMap Id Type.AST.TypeDeclaration) (HashMap Id Type.AST.Type)
= Blueprint (HashMap Id TypeDeclaration) (HashMap Id Type)
deriving (Eq, Show)

data Item
= Decl Id Type.AST.TypeDeclaration
| Func Id Type.AST.Type
= Decl Id TypeDeclaration
| Func Id Type

blueprint :: Text -> Either Text Blueprint
blueprint src = do
Expand Down Expand Up @@ -56,14 +56,14 @@ conv :: [Item] -> Blueprint
conv items =
Blueprint decls funcs
where
decls :: HashMap Id Type.AST.TypeDeclaration
decls :: HashMap Id TypeDeclaration
decls =
let xs = mapMaybe (\a -> case a of
Decl id def -> Just (id, def)
Func {} -> Nothing) items
in HashMap.fromList xs

funcs :: HashMap Id Type.AST.Type
funcs :: HashMap Id Type
funcs =
let xs = mapMaybe (\a -> case a of
Func id def -> Just (id, def)
Expand All @@ -72,22 +72,22 @@ conv items =

parseBlueprint :: Text -> Either (Mega.ParseErrorBundle Text Void) Blueprint
parseBlueprint =
fmap conv . Type.Parse.runParser programTypesParser "<input>"
fmap conv . Parse.runParser programTypesParser "<input>"

programTypesParser :: Type.Parse.Parser [Item]
programTypesParser :: Parse.Parser [Item]
programTypesParser = do
res <-
many $ Mega.try $ do
_ <- Lexer.indentGuard Type.Parse.spacesOrNewlines EQ Mega.pos1
_ <- Lexer.indentGuard Parse.spacesOrNewlines EQ Mega.pos1
parseOne
_ <- Lexer.indentGuard Type.Parse.spacesOrNewlines EQ Mega.pos1
_ <- Lexer.indentGuard Parse.spacesOrNewlines EQ Mega.pos1
pure res

parseOne :: Type.Parse.Parser Item
parseOne :: Parse.Parser Item
parseOne =
Mega.label "parseOne"
( Mega.try (fmap (uncurry Decl) Type.Parse.declEntryParser)
<|> Mega.try (fmap (uncurry Func) Type.Parse.defParser)
( Mega.try (fmap (uncurry Decl) Parse.declEntryParser)
<|> Mega.try (fmap (uncurry Func) Parse.defParser)
)

-- * Markdown
Expand Down
10 changes: 5 additions & 5 deletions bowtie-js/src/Bowtie/JS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ module Bowtie.JS
, runTextCommand
) where

import Bowtie.Core.Expr
import Bowtie.JS.Imperativize
import Bowtie.JS.Serialize
import Bowtie.JS.Imperativize (makeImp)
import Bowtie.JS.Serialize (serializeTop)
import Bowtie.Lib.Environment
import Bowtie.Lib.Prelude
import Data.String.QQ
import Data.String.QQ (s)
import Data.Text.Encoding (decodeUtf8)
import System.Process.Typed

import qualified Bowtie.Core.Expr as Core
import qualified Bowtie.Interpret as Interpret
import qualified Data.ByteString.Lazy as LBS
import qualified Data.Text as Text
Expand Down Expand Up @@ -51,7 +51,7 @@ transpile src = do
(env, coreExpr) <- Interpret.sourcesToCore mempty ("<input>", src)
pure (transpileCore env coreExpr)

transpileCore :: Environment -> Expr -> Text
transpileCore :: Environment -> Core.Expr -> Text
transpileCore env expr =
let
jsAST = makeImp env expr
Expand Down
2 changes: 1 addition & 1 deletion bowtie-js/test/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Main where
import Bowtie.Interpret
import Bowtie.JS
import Bowtie.Lib.Prelude
import Data.String.QQ
import Data.String.QQ (s)
import System.FilePath ((</>))
import Test.Hspec

Expand Down
16 changes: 8 additions & 8 deletions bowtie-visualize/src/Bowtie/Visualize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ module Bowtie.Visualize
) where

import Bowtie.Infer.Constraints
import Bowtie.Infer.Solve
import Bowtie.Infer.Solve (SolveError(..), next, solveConstraint)
import Bowtie.Lib.Environment
import Bowtie.Lib.Prelude
import Bowtie.Surface.AST (AST(astTerms, astTypes))
import Bowtie.Surface.Infer
import Bowtie.Type.Kindcheck
import Bowtie.Visualize.GraphConstraints
import Bowtie.Type.Kindcheck (kindcheck)
import Bowtie.Visualize.GraphConstraints (graphConstraints)
import Control.Monad.Except
import Control.Monad.State.Class
import System.Process.Typed
Expand All @@ -19,6 +18,7 @@ import qualified Bowtie.Infer.Constraints as Constraints
import qualified Bowtie.Interpret as Interpret
import qualified Bowtie.Surface.AST as Surface
import qualified Bowtie.Surface.Desugar as Surface.Desugar
import qualified Bowtie.Surface.Infer as Infer
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS
import qualified Data.List as List
Expand All @@ -41,12 +41,12 @@ run libFiles appFile = do
Surface.Desugar.extractResult (astTerms ast)

let
f :: (MonadState Int m, MonadError TypeError m) => m [Constraints]
f :: (MonadState Int m, MonadError Infer.TypeError m) => m [Constraints]
f = do
(constraints, _) <- gatherConstraints env dsg
mapError SolveError (solutionSteps constraints)
(constraints, _) <- Infer.gatherConstraints env dsg
mapError Infer.SolveError (solutionSteps constraints)

case runInfer f of
case Infer.runInfer f of
Left e ->
throwText (show e)

Expand Down
2 changes: 1 addition & 1 deletion bowtie/src/Bowtie/Surface/AST.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Bowtie.Surface.AST
) where

import Bowtie.Lib.FreeVars
import Bowtie.Lib.OrderedMap
import Bowtie.Lib.OrderedMap (OrderedMap)
import Bowtie.Lib.Prelude
import Bowtie.Type.AST

Expand Down

0 comments on commit 2b5b6ee

Please sign in to comment.