on master help sign in
Fixity declarations work in the repl now.
4d33a16Alyssa Carter
src/Idris/ASTUtils.hs+4
@@ -147,3 +147,7 @@ known_terms = Field (definitions . tt_ctxt)
147----------------------------
147----------------------------
148repl_definitions :: Field IState [Name]
148repl_definitions :: Field IState [Name]
149repl_definitions = Field idris_repl_defs (\v state -> state {idris_repl_defs = v})
149repl_definitions = Field idris_repl_defs (\v state -> state {idris_repl_defs = v})
150+
151+-- Fixity declarations in an IState
152+idris_fixities :: Field IState [FixDecl]
153+idris_fixities = Field idris_infixes (\v state -> state {idris_infixes = v})
src/Idris/REPL.hs+3−1
@@ -696,7 +696,9 @@ process h fn (NewDefn decls) = do
696 updateContext (addCtxtDef (getClauseName clause) (Function ty' tm'))
696 updateContext (addCtxtDef (getClauseName clause) (Function ty' tm'))
697 setReplDefined (Just $ getClauseName clause)
697 setReplDefined (Just $ getClauseName clause)
698 -- fixity and syntax declarations are ignored by elabDecls, so they'll have to be handled some other way
698 -- fixity and syntax declarations are ignored by elabDecls, so they'll have to be handled some other way
699− defineName (PFix{}:_) = tclift $ tfail (Msg "That kind of declaration is not supported. If you feel it should be supported, please submit an issue at https://github.com/idris-lang/Idris-dev.")
699+ defineName (PFix fc fixity strs : defns) = do
700+ fmodifyState idris_fixities (map (Fix fixity) strs ++)
701+ unless (null defns) $ defineName defns
700 defineName (PSyntax{}:_) = tclift $ tfail (Msg "That kind of declaration is not supported. If you feel it should be supported, please submit an issue at https://github.com/idris-lang/Idris-dev.")
702 defineName (PSyntax{}:_) = tclift $ tfail (Msg "That kind of declaration is not supported. If you feel it should be supported, please submit an issue at https://github.com/idris-lang/Idris-dev.")
701 defineName decls = do
703 defineName decls = do
702 elabDecls toplevel decls
704 elabDecls toplevel decls