Skip to content

Commit

Permalink
Werror clean
Browse files Browse the repository at this point in the history
  • Loading branch information
brprice committed Oct 20, 2021
1 parent 7a36067 commit c5d134c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions primer/src/Primer/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -66,7 +66,6 @@ import Primer.App (
QueryAppM,
Question (..),
Result (..),
appProg,
handleEvalFullRequest,
handleEvalRequest,
handleGetProgramRequest,
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion primer/src/Primer/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c5d134c

Please sign in to comment.