Commit Graph

6887 Commits

Author SHA1 Message Date
Edwin Brady
d7794a606a Merge pull request #2755 from Legogris/patch-1
Update Mystery Word example code
2015-10-21 08:34:33 +01:00
Edwin Brady
559a903c9b Merge pull request #2715 from cmcl/fix-effect-comment
Fixed comment of Effect type; ordering incorrect and vague.
2015-10-21 08:31:06 +01:00
Edwin Brady
3d5ead30c9 Merge pull request #2691 from mitchellwrosen/patch-1
pure -> pureM in depeff tutorial
2015-10-21 08:27:37 +01:00
Robert Edström
f4ed74c7cf Update Mystery Word example code
* Make it typecheck (previous version of game function didn't)
* Make it more readable (if instead of case over bool, explicit precondition on NewWord)
2015-10-20 16:56:36 +02:00
Edwin Brady
06edf43977 Add implicit lambdas for top level implicits
They shouldn't really be treated differently from scoped implicits
during elaboration... Fixes #1536
2015-10-19 00:05:41 +01:00
Edwin Brady
c7bed76d1f Better disambiguation with type class methods
If a type class resolution fails in an unrecoverable way (i.e., it
hasn't been postponed due to missing arguments) then it won't be one of
the things we're choosing between in type-based disambiguation, so rule
it out.

Fixes #2701
2015-10-18 00:39:19 +01:00
Edwin Brady
c6a8862798 Add %deprecate directive
Usage:

%deprecate [name] [optional reason, as a string literal]

If 'name' is used anywhere, display a warning that it is deprecated,
along with the message.

e.g. perhaps we should shortly add:

%deprecate Float "Use Double instead. Float will be removed soon."
2015-10-17 23:22:55 +01:00
Edwin Brady
53f46510bc Tidy up name warnings in Prelude 2015-10-17 23:22:29 +01:00
Edwin Brady
47b83b8d41 Change type of HVect.put/get/update so auto works
auto implicits need to go after the arguments they refer to, because
elaboration works left to right, and until we have better rules they may
end up solving things too early if we're not careful.

Currently: Proof search will start as long as no metavariables in the
goal type correspond to positions in the data type where an argument is
in constructor form (i.e., solving by that constructor would work
trivially, thus solving the metavariable too early).

Fixes #2656
2015-10-17 20:26:15 +01:00
Edwin Brady
a35ccd6adb Update Eff constructors to remove warnings 2015-10-17 20:22:08 +01:00
Edwin Brady
da914af83e Consistency of implicit/pattern name binding rules
We've always said that the rules for binding names in patterns are the
same as the rules for binding names in implicits, i.e. a name beginning
with a lower case letter, not applied to anything, will be bound
implicitly, or treated as a pattern variable. This hasn't actually
always been quite true, even though it was supposed to be...

Correspondingly, added a warning for constructor names which may be
unexpectedly bound implicitly.

This patch changes the pattern binding rules so that it is the case.
Fixes #2653
2015-10-17 18:44:00 +01:00
Edwin Brady
a458e29d09 Take care when calling allNamesIn
If we've expanded alternatives, the term could be very big, and we'll
get the same results if we call before expanding alternatives. If we do
need to know all the names a user has written in a term, call before
expanding the alternatives.

This addresses part of the slowness identified in #2657
2015-10-17 17:09:16 +01:00
Edwin Brady
83f0af13fb Display expected type of RHS in error messages
Also added %error_reverse annotations on IO so that IO related messages
are more readable. This improves the error in #2672.
2015-10-17 14:30:36 +01:00
Edwin Brady
db0787555d Merge "add definition" and "add missing" commands
If a function already exists, then adding a definition will now add the
missing cases (so in general, \d in vim or corresponding commands in
other editors will now add all the necessary clauses for a covering
definition.)
2015-10-17 00:01:27 +01:00
Edwin Brady
8996abfa8e Parse to line now reads whole definition
Instead of stopping at the first declaration after it reaches the line
it wants, stop at the first non-pattern-match, so that it still reads
the entire definition to avoid strange totality errors. This mostly
helps the vim mode, and :addmissing.
2015-10-17 00:01:27 +01:00
David Christiansen
c98e24f2cc Merge pull request #2746 from david-christiansen/pruviloj
Elab updates
2015-10-16 19:47:35 +02:00
David Raymond Christiansen
f7e1990ce4 Add lookup of FunArgs for global names to Elab
This makes it possible to write elaborators for term languages that use
Idris's plicity information. As a test of this, the test suite now
includes a mini-implementation of a subset of Agda's reflection using
Elab.
2015-10-16 18:55:24 +02:00
David Raymond Christiansen
6a208f71a6 Fix docstrings for apply and matchApply 2015-10-16 14:36:44 +02:00
David Christiansen
c5f5dab91e Merge pull request #2741 from david-christiansen/pruviloj
Pruviloj-related updates
2015-10-16 07:56:55 +02:00
David Raymond Christiansen
5323b12865 Remove obsolete Elab primitive from Term.hs 2015-10-16 01:41:57 +02:00
David Raymond Christiansen
5330e8a00c Simplifications to Elab
apply is simplified and forget has been moved to library code.
2015-10-16 01:24:38 +02:00
David Raymond Christiansen
ab62c98f99 Make cycle test work with Curses Idris 2015-10-16 01:02:26 +02:00
David Raymond Christiansen
1edba410d4 Add environment argument to Elab.Tactics.check
Now, type checking can be performed in arbitrary environments.
2015-10-15 14:42:49 +02:00
David Raymond Christiansen
68c519e532 Convert comments in WHNF.hs to Haddock 2015-10-15 13:25:25 +02:00
Niklas Larsson
d2f892b502 Merge pull request #2728 from jeremy-w/jeremy-w/ipkg-allow-arbitrary-executable-names-2721
IPKG: Relax requirement that executable name be a valid identifier [#2721]
2015-10-14 23:22:39 +02:00
Niklas Larsson
aabda6e19c Merge pull request #2735 from LeifW/bump_vector_constraint
Bump vector constraint to allow 0.11.x
2015-10-14 22:53:25 +02:00
Leif Warner
304a7e7ce2 Bump vector constraint to allow 0.11.x
fixes #2734
2015-10-14 12:38:52 -07:00
Edwin Brady
8bd99edf3e Detect cycles in imports
Also improve import chasing, by only following imports in the current
source tree (so not in dependencies we happen to have the source for,
which will be part of other packages)
2015-10-14 15:37:21 +01:00
Edwin Brady
fe38aac9c9 Cache information when module chasing
In particular - don't parse import lists more than once for each file,
and once a part of the import tree is built, don't build it again.

Fixes #2730
2015-10-13 23:51:24 +01:00
Edwin Brady
4249691bd8 Check whether type declarations are actually types
We never did bother to check, and they are unusable if they don't have
a constructor with either Type/UniqueType... Fixes #2698
2015-10-13 23:51:24 +01:00
Jeremy W. Sherman
9229b623df PParser.hs: filename: Add check that path is valid
In addition to ensuring the filename is:

- Non-empty
- Filename only (no directory separator)

This also checks:

- No invalid characters are present
2015-10-13 14:56:14 -04:00
Jeremy W. Sherman
ee589b5475 PParser.hs: Use ConstraintKinds to avoid "illegal tuple constraint"
Fixes compiler error reported by Travis under GHC 7.6 and 7.8.

Thanks @melted for calling this out
(https://github.com/idris-lang/Idris-dev/pull/2728#issuecomment-147666654).
2015-10-13 14:47:13 -04:00
Jeremy W. Sherman
b329791cf1 Add @jeremy-w to CONTRIBUTORS
As encouraged by @melted in
https://github.com/idris-lang/Idris-dev/pull/2728#issuecomment-147667042
2015-10-13 14:44:41 -04:00
David Christiansen
6c4deb24c1 Merge pull request #2718 from david-christiansen/pruviloj
Pruviloj and reflection updates
2015-10-13 13:43:55 +02:00
Niklas Larsson
16ed52de63 Merge pull request #2719 from jeremy-w/jeremy-w/edit-elaborator-reflection
docs: Update the "Interactively Building Elab Scripts" section
2015-10-13 11:55:02 +02:00
Jeremy W. Sherman
9c8d8cc424 CHANGELOG: Fix typo: mutliple -> multiple 2015-10-13 00:12:40 -04:00
Jeremy W. Sherman
4f96945a3b Test that IPKG rejects executable with directory component
This ensures it really is a filename, and prevents something unwanted like
telling it to write to ../something or /something.
2015-10-13 00:00:59 -04:00
Jeremy W. Sherman
a22dd61eac Add test that quoted strings with valid filenames are OK
This tests the new functionality added to support hyphens in filenames
(see: https://github.com/idris-lang/Idris-dev/issues/2721).
2015-10-12 23:33:03 -04:00
Jeremy W. Sherman
4274456d4d Add test that IPKG executable accepts namespaced identifier
This tests that the current behavior of Idris when parsing the target
executable name is preserved.
2015-10-12 23:32:44 -04:00
Jeremy W. Sherman
67ff67e4d8 PParser.hs: filename: Explain failed parse with |fail|
This still provides misleading output from the parser about what it
was expecting, but does explain what the actual problem was:

    *Pkg.PParser> execout <$> runparser pPkg defaultPkg "foo.ipkg"
                  "package bar\n\nexecutable = \"invalid/filename\""
    Failure foo.ipkg:3:32: error: a filename
        must be non-empty and have no
        directory
        component, expected: space
    executable = "invalid/filename"<EOF>
                                   ^
2015-10-12 23:16:00 -04:00
Jeremy W. Sherman
3ccdc4b7c7 PParser.hs: filename: Verify it is a non-empty filename
Using |guard| after the parser has done its work leads to unfortunate
error messages on parse failure, though:

    *Pkg.PParser> execout <$> runparser pPkg defaultPkg "foo.ipkg"
                  "package bar\n\nexecutable = \"invalid/filename\""
    Failure foo.ipkg:3:32: error: expected: space
    executable = "invalid/filename"<EOF>
                                   ^
2015-10-12 23:11:36 -04:00
Jeremy W. Sherman
44b87ecd19 PParser.hs: filename: Restore backwards compatibility
We've used iName to parse the executable filename till now.
This change ensures we don't break any extant IPKG files.
2015-10-12 22:44:29 -04:00
Jeremy W. Sherman
5eeaf9e1c7 PParser.hs: filename: Remove use of |try|
There's no need to rewind consumed input here should parsing fail,
so there's no need for |try|.

Thanks @david-christiansen for pointing this out.
2015-10-12 22:15:45 -04:00
Jeremy W. Sherman
d75e4c6d29 Remove advice to import Language.Reflection.Elab
This no longer applies as of HEAD, as pointed out by @david-christiansen,
because the Prelude now includes this namespace.

Replace the advice with a tip to :browse the Tactics module to see the list of
tactics prior to entering the elab shell.
2015-10-12 18:27:23 -04:00
Jeremy W. Sherman
c6c4bf4688 Drop claim that general-purpose commands are general REPL commands
:e at least is not, as pointed out by @david-christiansen.
2015-10-12 18:21:25 -04:00
Jeremy W. Sherman
d17f246735 Remove duplicated phrase 2015-10-12 18:21:03 -04:00
Jeremy W. Sherman
f30db6b227 Fix typo: reply -> REPL
Thanks to @david-christiansen for catching this.
2015-10-12 18:19:36 -04:00
David Raymond Christiansen
1e687f3b5d Rename record fields in reflection
Now, there is more overloading, but we get simpler, more memorable names
as a result.
2015-10-12 20:05:09 +02:00
Jeremy W. Sherman
ffa41abb50 CONTRIBUTING.md: Fix typo "Factroy" -> "Factory" 2015-10-12 00:25:54 -04:00
Jeremy W. Sherman
b6a8a95b7c PParser.hs: Parse executable clause argument as filename
Previously, it was parsed as an iName, AKA a possibly-namespaced identifier.

This meant you could have dots in your executable's name, but no hyphens!

See: #2721: Allow dashes in package names
(https://github.com/idris-lang/Idris-dev/issues/2721)
2015-10-12 00:22:29 -04:00