Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion brat/Brat/Checker/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ mkFork :: String -> Free sig () -> Free sig ()
mkFork d par = thTrace ("Forking " ++ d) $ Fork d par $ pure ()

mkYield :: String -> S.Set End -> Free sig ()
mkYield desc es = thTrace ("Yielding in " ++ desc ++ "\n " ++ show es) $ Yield (AwaitingAny es) (\_ -> trackM ("woke up " ++ desc) >> Ret ())
mkYield desc es = thTrace ("Yielding in " ++ desc ++ "\n " ++ show es) $
Yield (AwaitingAny es) (\_ -> trackM ("woke up " ++ desc) >> Ret ())

-- Commands for synchronous operations
data CheckingSig ty where
Expand Down
7 changes: 6 additions & 1 deletion brat/Brat/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

import Brat.FC
import Data.Bracket
import Brat.Syntax.Port (PortName)
import Brat.Syntax.Port (End, PortName)

import Data.List (intercalate)
import Data.Set (Set, toList)
import System.Exit

newtype ParseError = PE { pretty :: String }
Expand Down Expand Up @@ -109,6 +110,8 @@
| ThunkLeftUnders String
| BracketErr BracketErrMsg
| RemainingNatHopes [String]
| NeedToKnow (Set End)
| Both ErrorMsg ErrorMsg

instance Show ErrorMsg where
show (TypeErr x) = "Type error: " ++ x
Expand Down Expand Up @@ -194,6 +197,8 @@
show (ThunkLeftUnders unders) = "Expected function to return additional values of type: " ++ unders
show (BracketErr msg) = show msg
show (RemainingNatHopes hs) = unlines ("Expected to work out values for these holes:":((" " ++) <$> hs))
show (NeedToKnow ends) = unlines $ "I wanna know what:" : ((' ':) . show <$> toList ends) ++ ["is."]
show (Both err1 err2) = unlines [show err1,""," AND ALSO","",show err2]

data Error = Err { fc :: Maybe FC
, msg :: ErrorMsg
Expand Down Expand Up @@ -240,8 +245,8 @@
ls = lines contents
in case endLineN - startLineN of
0 -> [ls!!startLineN, highlightSection startCol endCol]
n | n > 0 -> let (first:rest) = drop (startLineN - 1) $ take (endLineN + 1) ls

Check warning on line 248 in brat/Brat/Error.hs

View workflow job for this annotation

GitHub Actions / build

Pattern match(es) are non-exhaustive

Check warning on line 248 in brat/Brat/Error.hs

View workflow job for this annotation

GitHub Actions / build

Pattern match(es) are non-exhaustive
(last:rmid) = reverse rest

Check warning on line 249 in brat/Brat/Error.hs

View workflow job for this annotation

GitHub Actions / build

Pattern match(es) are non-exhaustive

Check warning on line 249 in brat/Brat/Error.hs

View workflow job for this annotation

GitHub Actions / build

Pattern match(es) are non-exhaustive
in [first, highlightSection startCol (length first)]
++ (reverse rmid >>= (\l -> [l, highlightSection 0 (length l)]))
++ [last, highlightSection 0 endCol]
Expand Down
2 changes: 1 addition & 1 deletion brat/Control/Monad/Freer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import qualified Data.Set as S
-- * e -> Unstuck means e has been solved
-- * e -> Awaiting es means the problem's been transferred
-- * e not in news means no change to e
newtype News = News (M.Map End Stuck)
newtype News = News (M.Map End Stuck) deriving Show

updateEnd :: News -> End -> Stuck
updateEnd (News m) e = case M.lookup e m of
Expand Down
Loading