Skip to content

Commit

Permalink
[ #8 ] Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Nov 19, 2018
1 parent b22cd6b commit 0bba920
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ test_script:
- stack setup
# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
# descriptor
- echo "" | stack --no-terminal install
# - echo "" | stack --no-terminal test
- echo "" | stack install
7 changes: 5 additions & 2 deletions src/full/OwO/Syntax/Abstract.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ data QName = QName
, concretName :: Name
} deriving (Eq, Generic, Ord, Show)

simpleName :: QName -> T.Text
simpleName = textOfName . nameConcrete . concretName
simpleQName :: QName -> T.Text
simpleQName = C.textOfName . nameConcrete . concretName

simpleName :: Name -> T.Text
simpleName = C.textOfName . nameConcrete

-- | Program Structure Item: File
data PsiFile = PsiFile
Expand Down
2 changes: 1 addition & 1 deletion src/full/OwO/Syntax/Concret.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import GHC.Generics (Generic)
in different locations are equal.
-}
data Name
= Name Loc Text -- ^ A identifier.
= Name Loc T.Text -- ^ A identifier.
| NoName Loc NameId -- ^ @_@.
deriving (Generic, Ord, Show)

Expand Down
6 changes: 3 additions & 3 deletions src/full/OwO/TypeChecking/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ lookupCtxWithName currentModule name ctx =
Map.lookup currentModule ctx >>= Map.lookup name

lookupCtx :: QName -> TCCtx a -> Maybe a
lookupCtx (QName currentModule name) = lookupCtxWithName currentModule $ nameConcret name
lookupCtx (QName currentModule name) = lookupCtxWithName currentModule $ simpleName name

-- | Overwriting
addDefinitionWithName :: QModuleName -> TextName -> a -> TCCtx a -> TCCtx a
addDefinitionWithName targetModule name a ctx = fromMaybe ctx $
(\ modifiedCtx -> Map.insert targetModule modifiedCtx ctx) <$>
Map.insert name a <$> Map.lookup targetModule ctx

addDefinition :: QName -> a -> TCCtx a -> Maybe a
addDefinition (QName currentModule name) = lookupCtxWithName currentModule $ nameConcret name
addDefinition :: QName -> a -> TCCtx a -> TCCtx a
addDefinition (QName currentModule name) = addDefinitionWithName currentModule $ simpleName name

-- | TypeChecking State. I haven't decide on whether to store warnings here
-- (but errors should definitely be in the other side of the Monad)
Expand Down

0 comments on commit 0bba920

Please sign in to comment.