Skip to content

Commit

Permalink
ignore location
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Feb 8, 2024
1 parent 27a27a1 commit 02eda67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/Juvix/Compiler/Nockma/Language.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ data StdlibCall a = StdlibCall
deriving stock (Show, Eq, Lift)

data CellInfo a = CellInfo
{ _cellInfoLoc :: Maybe Interval,
{ _cellInfoLoc :: Irrelevant (Maybe Interval),
_cellInfoCall :: Maybe (StdlibCall a)
}
deriving stock (Show, Eq, Lift)
Expand All @@ -70,7 +70,7 @@ data Cell a = Cell'

data AtomInfo = AtomInfo
{ _atomInfoHint :: Maybe AtomHint,
_atomInfoLoc :: Maybe Interval
_atomInfoLoc :: Irrelevant (Maybe Interval)
}
deriving stock (Show, Eq, Lift)

Expand Down Expand Up @@ -183,13 +183,13 @@ termLoc f = \case
TermCell a -> TermCell <$> cellLoc f a

cellLoc :: Lens' (Cell a) (Maybe Interval)
cellLoc = cellInfo . cellInfoLoc
cellLoc = cellInfo . cellInfoLoc . unIrrelevant

cellCall :: Lens' (Cell a) (Maybe (StdlibCall a))
cellCall = cellInfo . cellInfoCall

atomLoc :: Lens' (Atom a) (Maybe Interval)
atomLoc = atomInfo . atomInfoLoc
atomLoc = atomInfo . atomInfoLoc . unIrrelevant

naturalNockOps :: HashMap Natural NockOp
naturalNockOps = HashMap.fromList [(serializeOp op, op) | op <- allElements]
Expand Down Expand Up @@ -354,14 +354,14 @@ emptyCellInfo :: CellInfo a
emptyCellInfo =
CellInfo
{ _cellInfoCall = Nothing,
_cellInfoLoc = Nothing
_cellInfoLoc = Irrelevant Nothing
}

emptyAtomInfo :: AtomInfo
emptyAtomInfo =
AtomInfo
{ _atomInfoHint = Nothing,
_atomInfoLoc = Nothing
_atomInfoLoc = Irrelevant Nothing
}

class NockmaEq a where
Expand Down
8 changes: 4 additions & 4 deletions src/Juvix/Compiler/Nockma/Translation/FromSource/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ atomOp = do
let info =
AtomInfo
{ _atomInfoHint = Just AtomHintOp,
_atomInfoLoc = Just loc
_atomInfoLoc = Irrelevant (Just loc)
}
return (Atom (serializeNockOp op') info)

Expand All @@ -95,7 +95,7 @@ atomDirection = do
let info =
AtomInfo
{ _atomInfoHint = Just AtomHintOp,
_atomInfoLoc = Just loc
_atomInfoLoc = Irrelevant (Just loc)
}
return (Atom (serializePath dirs) info)

Expand All @@ -105,7 +105,7 @@ atomNat = do
let info =
AtomInfo
{ _atomInfoHint = Nothing,
_atomInfoLoc = Just loc
_atomInfoLoc = Irrelevant (Just loc)
}
return (Atom n info)

Expand Down Expand Up @@ -150,7 +150,7 @@ cell = do
info =
CellInfo
{ _cellInfoCall = c,
_cellInfoLoc = Just (lloc <> rloc)
_cellInfoLoc = Irrelevant (Just (lloc <> rloc))
}
return (set cellInfo info r)
where
Expand Down

0 comments on commit 02eda67

Please sign in to comment.