Commit Graph

33 Commits

Author SHA1 Message Date
stefan-hoeck
7ef6b79ab1 Remove Control.Monad.Trans.Either from contrib 2021-01-22 08:10:47 +01:00
stefan-hoeck
8074ad1f8d Make Control.Validation use Control.Monad.Error.Either 2021-01-22 08:08:34 +01:00
André Videla
60527d127f
Merge pull request #554 from Sventimir/validation
Input validation
2021-01-22 01:30:07 +00:00
André Videla
3bd2fae525
Update Arrow.idr 2021-01-22 00:54:58 +00:00
André Videla
2e063544e8
Update Category.idr 2021-01-22 00:53:59 +00:00
Stefan Hoeck
fb08004041
removed trailing whitespace (#955) 2021-01-21 11:33:03 +00:00
Stiopa Koltsov
b76c9d91e0 Remove trailing whitespaces and add trailing newlines 2021-01-16 10:00:03 +00:00
André Videla
c1bd61b58d
Merge branch 'master' into validation 2021-01-13 17:07:18 +00:00
Edwin Brady
d4abbfdae2 Add HasLinearIO
Ideally, liftIO would always be linear, but that has lots of knock-on
effects for other monads which we might want to put in HasIO, now that
subtyping is gone. We'll have to revisit this when we have some kind of
multiplicity polymorphism.
2021-01-11 11:24:43 +00:00
Edwin Brady
ad632d825d Remove linearity subtyping
It's disappointing to have to do this, but I think necessary because
various issue reports have shown it to be unsound (at least as far as
inference goes) and, at the very least, confusing. This patch brings us
back to the basic rules of QTT.

On the one hand, this makes the 1 multiplicity less useful, because it
means we can't flag arguments as being used exactly once which would be
useful for optimisation purposes as well as precision in the type. On
the other hand, it removes some complexity (and a hack) from
unification, and has the advantage of being correct! Also, I still
consider the 1 multiplicity an experiment.

We can still do interesting things like protocol state tracking, which
is my primary motivation at least.

Ideally, if the 1 multiplicity is going to be more generall useful,
we'll need some kind of way of doing multiplicity polymorphism in the
future. I don't think subtyping is the way (I've pretty much always come
to regret adding some form of subtyping).

Fixes #73 (and maybe some others).
2020-12-27 19:58:35 +00:00
Sventimir
01e6263a87 Introduce the notion of PropValidator so that value under validation gets ignored more explicitly in those. 2020-08-18 13:56:21 +02:00
Sventimir
ba197a230e Port Control.Arrow from Idris. 2020-08-15 16:42:00 +02:00
Sventimir
c6d8ef30ed Add Control.Category module ported from Idris. 2020-08-15 14:27:27 +02:00
Sventimir
021a5a6154 Update the docs. 2020-08-13 18:28:39 +02:00
Sventimir
ffbfecb376 Fix broken name of the module. 2020-08-13 17:52:43 +02:00
Sventimir
daad29deb6 Remove redundant constructor to the ValidatorT type. 2020-08-13 17:49:22 +02:00
Sventimir
41444e5050 Export publicly the Validator type alias. 2020-08-12 17:37:48 +02:00
Sventimir
208fb6fe04 Turn Validator into a proper monad transformer. 2020-08-11 20:52:13 +02:00
Sventimir
6389aa4099 Add initial validation framework. 2020-08-11 18:27:06 +02:00
Nick Drozd
a2bdf8e6d7 Add some algebra implementations 2020-07-17 08:25:20 -05:00
Edwin Brady
9d1bb82c48
Merge pull request #242 from nickdrozd/algebra
Add Algebra interfaces and laws
2020-07-05 00:04:13 +01:00
Niklas Larsson
53621f84c5
Merge pull request #370 from ShinKage/ansi
Adds ANSI codes support in contrib
2020-06-29 19:43:46 +02:00
André Videla
8d04881356 Add Kleisli arrow operators to contrib 2020-06-27 22:02:05 +01:00
Giuseppe Lomurno
28018d9573 Fixed typo 2020-06-26 21:26:36 +02:00
Giuseppe Lomurno
5ccc6a397d Added Control.ANSI module in contrib 2020-06-26 19:10:02 +02:00
Edwin Brady
9576fdc1d3 LIO.run needs exporting
It's useless without it!
2020-06-25 11:57:17 +01:00
Edwin Brady
ebc413ede5 Postpone elaborating lambdas
It's worth delaying in case doing some more work (and some more
interface resolution) can make the type more concrete. This makes
test linear011 work more smoothly, and will help with this sort of
program in general.

A better way, later, would be to try elaborating and delay only if the
type is not yet known. We have the facilities, but it's too fiddly for
me to want to implement it right now...
2020-06-24 23:27:45 +01:00
Edwin Brady
854804dbfb Determining argument check below top level
We need to check below top level too, since there could be holes that
we're happy to resolve by searching. The linearity test added
illustrates a place where this is needed.
2020-06-24 22:07:52 +01:00
Edwin Brady
ff619951f0 Reorganise LIO to allow 'pure'
Doing this is awkward, for a number of reasons, including 'pure' not
being linear in its argument - there's no guarantee it'll be used
linearly after all - and lack of multiplicity polymorphism. Fortunately
the user doesn't have to know about the ugliness underneath!

We can look at ways to make it less horrible later :). For now, this is
starting to look like something that allows us to write linear protocols
without too much extra machinery on top of IO.
2020-06-24 21:24:15 +01:00
Edwin Brady
8540d2fb9a Add experimental library for linear computations
In Control.Linear.LIO - allows wrapping anything that supports chaining
of linear computations (most usefully, IO).
2020-06-23 23:11:48 +01:00
Nick Drozd
028a1cb960 Cut some let bindings 2020-06-18 10:12:13 -05:00
Nick Drozd
d7ca30b710 Add Algebra interfaces and laws 2020-06-18 10:12:13 -05:00
Edwin Brady
dec7dff622 Add libraries 2020-05-18 14:00:08 +01:00