From c5d134c3e8589f31bbfaf3c504d18bf84e8e5076 Mon Sep 17 00:00:00 2001 From: Ben Price Date: Wed, 20 Oct 2021 13:21:23 +0100 Subject: [PATCH] Werror clean --- primer/src/Primer/API.hs | 22 +++++++++++----------- primer/src/Primer/App.hs | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/primer/src/Primer/API.hs b/primer/src/Primer/API.hs index 5e67cb7b8..b9cba3dea 100644 --- a/primer/src/Primer/API.hs +++ b/primer/src/Primer/API.hs @@ -48,7 +48,7 @@ import Control.Concurrent.STM ( ) import Control.Monad.Catch (MonadThrow, throwM) import Data.Aeson (ToJSON) -import Data.Data (Data, showConstr, toConstr) +import Data.Data (showConstr, toConstr) import qualified Data.Generics.Uniplate.Data as U import qualified Data.Map as Map import qualified ListT (toList) @@ -66,7 +66,6 @@ import Primer.App ( QueryAppM, Question (..), Result (..), - appProg, handleEvalFullRequest, handleEvalRequest, handleGetProgramRequest, @@ -271,7 +270,8 @@ liftQueryAppM h sid = withSession' sid (QueryApp $ runQueryAppM h) --getProgram :: (MonadIO m, MonadThrow m) => SessionId -> PrimerM m (Result ProgError Prog) --getProgram = liftQueryAppM handleGetProgramRequest getProgram :: (MonadIO m, MonadThrow m) => SessionId -> PrimerM m APIProg -getProgram sid = withSession' sid $ QueryApp $ viewProg . appProg +--getProgram sid = withSession' sid $ QueryApp $ viewProg . appProg +getProgram sid = withSession' sid $ QueryApp $ viewProg . handleGetProgramRequest -- REVIEW: (data Tree): should we put this in primer or primer-service -- - what should the API module return? @@ -332,28 +332,28 @@ viewTreeExpr :: Expr -> Tree viewTreeExpr = U.para $ \e exprChildren -> let c = toS $ showConstr $ toConstr e n = case e of - Con _ n -> c <> " " <> unName n - Var _ n -> c <> " " <> unName n + Con _ n' -> c <> " " <> unName n' + Var _ n' -> c <> " " <> unName n' _ -> c -- add info about type children - children = case e of + allChildren = case e of Ann _ _ ty -> exprChildren ++ [viewTreeType ty] APP _ _ ty -> exprChildren ++ [viewTreeType ty] LetType _ _ ty _ -> viewTreeType ty : exprChildren Letrec _ _ _ ty _ -> let (h, t) = splitAt 1 exprChildren in h ++ viewTreeType ty : t -- otherwise, no type children _ -> exprChildren - in Tree (getID e) n children + in Tree (getID e) n allChildren -- | Similar to 'viewTreeExpr', but for 'Type's viewTreeType :: Type -> Tree -viewTreeType = U.para $ \e children -> +viewTreeType = U.para $ \e allChildren -> let c = toS $ showConstr $ toConstr e n = case e of - TCon _ n -> c <> " " <> unName n - TVar _ n -> c <> " " <> unName n + TCon _ n' -> c <> " " <> unName n' + TVar _ n' -> c <> " " <> unName n' _ -> c - in Tree (getID e) n children + in Tree (getID e) n allChildren edit :: (MonadIO m, MonadThrow m) => SessionId -> MutationRequest -> PrimerM m (Result ProgError Prog) edit sid req = liftEditAppM (handleMutationRequest req) sid diff --git a/primer/src/Primer/App.hs b/primer/src/Primer/App.hs index 8055f8729..15afd124a 100644 --- a/primer/src/Primer/App.hs +++ b/primer/src/Primer/App.hs @@ -292,7 +292,7 @@ focusNode prog defid nodeid = Just x -> pure x -- | Handle a request to retrieve the current program -handleGetProgramRequest :: MonadQueryApp m => m Prog +handleGetProgramRequest :: MonadReader App m => m Prog handleGetProgramRequest = asks appProg -- | Handle a request to mutate the app state