But I am still confused by the exact definition of coherence in the case of
overlapping. Does the standard coherence theorem apply? If yes, how?
If no, is there a theorem?
Yes, the is, by Martin Sulzmann et al, the Theory of overloading (the
journal version)
John Meacham wrote:
things like DeepSeq and Typeable will most likely have optimized
versions on various compilers which is why I'd like to see the
restriction that the only way to create instances for these two
classes is via the deriving mechanism of the compiler.
Please make it so!
Claus Reinke wrote:
I hadn't given that much thought before, because FDs are meant
to determine their range types, and there isn't much difference
between universal and existential quantification if there is only
one possible variable value, eg:
(forall a in {Char}.
Daniel McAllansmith wrote:
When I try to add MonadError into the types I eventually hit the
requirement for allow-undecidable-instances. Is there some way I can
I avoid having to use this extension?
class (Num i, Bounded i, Monad m, MonadError String m)
= MonadSource i m | m - i
shelarcy wrote:
SXML can add useful function for macro, like this;
(define (M:link keyword url)
`(a (@ (href ,url)) ,keyword))
(define (M:link_amazon keyword asin)
(M:link keyword
`(http://www.amazon.co.jp/exec/obidos/ASIN/; ,asin /someone_id/)))
(define (M:book keyword
Doaitse Swierstra wrote:
In Haskell we write `f` in order to infixify the identifier f. In ABC
the stuff between backquotes is not limited to an identifier, but any
expression may occur there. This would allow one to write e.g.
xs `zipWith (+)` ys
Chung-chieh Shan and Dylan Thurston
Claus Reinke wrote:
overlapping instances with best-fit overlap resolution are useful
because they give us an alternative way to write programs that
we cannot write directly as long as current Haskell isn't expressive
enough:
(a) we can't specify that two types in an instance are not
Greg Buchholz wrote:
Is it possible to make a typeclass like Functor, that has a function
(say f_map), which would work for the infinite hierarchy of types:
([],[[]],[[[]]],...)?
You do understand that this requires overlapping instances? Because
the type [[Bool]] is still a list. In
Matijs Erisson, who suggested
I provide rss.xml feed for my site. You can see the ChangeLog in the
master format and its two renderings at
http://pobox.com/~oleg/ftp/ChangeLog.hs
http://pobox.com/~oleg/ftp/ChangeLog.html
http://pobox.com/~oleg/ftp/rss.xml
The updated archive
tags
and their constraints), this message is not the complete code. The
code is available from
http://pobox.com/~oleg/ftp/Haskell/HSXML.tar.gz
Please see the files HSXML.hs, HSXML_HTML.hs and the sample code
sample1c.hs for the data-centric framework. The monad-centric
framework is in one
Martin Sulzmann wrote:
- The type functions are obviously terminating, e.g.
type T [a] = [[a]] clearly terminates.
- It's the devious interaction between instances/superclasss
and type function which causes the type class program
not to terminate.
Is there a possible fix? Here's a
Let's consider the general case (which I didn't describe in my earlier
email).
In case we have an n-ary type function T (or (n+1)-ary type class
constraint T) the conditions says for each
type T t1 ... tn = t
(or rule T t1 ... tn x == t)
then rank(ti) rank(t) for each i=1,..,n
I
Martin Sulzmann wrote:
Let's consider the general case (which I didn't describe in my earlier
email).
In case we have an n-ary type function T (or (n+1)-ary type class
constraint T) the conditions says for each
type T t1 ... tn = t
(or rule T t1 ... tn x == t)
then rank(ti) rank(t)
An earlier message showed an example of writing code with non-trivial
static guarantees in the present-day Haskell (i.e., Haskell98 + rank-2
types).
http://pobox.com/~oleg/ftp/Haskell/types.html#branding
Although this approach obviously falls short of the genuine dependent
typing, we
The ability to use functions 'catch', 'bracket', 'catchDyn', etc. in
MonadIO other than IO itself has been a fairly frequently requested
feature:
http://www.haskell.org/pipermail/glasgow-haskell-users/2003-September/005660.html
http://haskell.org/pipermail/libraries/2003-February/000774.html
Simon Marlow wrote:
I suggest you follow the same scheme as the unboxed array types, and
have IOURef/STURef types, parameterised over the element type. Of
course, we should have instances for all of the primitive numeric types
plus Ptr, ForeignPtr, StablePtr, Bool.
Perhaps it may be worth
We show invertible, terminating, 3-place addition, multiplication, and
exponentiation relations on type-level Peano numerals, where _any_ two
operands determine the third. We also show the invertible factorial
relation. This gives us all common arithmetic operations on Peano
numerals, including
In the recent message about regions I wrote:
Typeable constraint has reduced the problem of 'region nesting' to the
regular problem of the 'linearity' of computations -- which is already
solved in ST monad. We can add that pervasive 's' type parameter to
our Q and IOM types. However, the
testMinus1 = join $ runIOM $ withFile /etc/motd $
return . runIOM . qGetChar
Isn't this the same situation we have in Haskell98 with respect to the
regular IO? The safety of IO depends on the fact that the IO type
constructor cannot be eliminated. Hence the
Simon Peyton-Jones wrote:
Don't side effects kill you?
withFile foo (\q - writeIORef var q)
No. Computations within the body of |withFile| must be within the
|IOM| monad. These computations are built from |unit| and those
computations exported from IORegions98 that are deemed safe.
After an experiment with the simple IO regions, one can conclude that
the only implementation of the regions has to be complex. It seems
however that there is a Haskell98 implementation of IO regions. The
solution involves no higher-ranked types, and works both in GHC and
Hugs. The idea is
Simon Peyton-Jones wrote:
Previously I've thought of using a nested tuple type
(m1, (m2, (m3 (
That was my thought too. But then we need the comparison operation on
those 'm' (which are actually type eigen-variables). Not that it can't
be done (it can, and several examples prove
Bill Wood wrote:
is |nabla x, nabla y. phi(x,y)| logically equivalent to
|forall x, forall y. x y only-if phi(x,y)|? I use |P only-if Q| for
|P materially implies Q|
First of all, I should remark that Miller and Tiu introduce two
calculi (with names that are hardly speakable, even in TeX).
This message shows a very simple implementation of Monadic Regions
(for the particular case of IO and reading the file). The technique
*statically* guarantees that neither a file handle nor any computation
involving the handle can leak outside of the region that created
it. Therefore, the handle
Krasimir Angelov wrote:
There are three active database libraries: HDBC, HSQL and Takusen.
It is quite disappointing from my point of view. Recently there was
the same situation with the GUI libraires.
I think the dichotomy between lower-level Haskell libraries (whose API
is closer/faithful
to the ``current list''. We are merely given
the current element of the list. Perhaps the following links might be
of help:
http://www.eros-os.org/pipermail/e-lang/2004-March/009643.html
http://pobox.com/~oleg/ftp/Haskell/misc.html#fold-stream
http://pobox.com/~oleg/ftp/papers/LL3-collections
Axel Simon wrote, in response to Keean Schupke
dbConnectWith :: DbName - (DbHandle - IO Result) - Result
dbConnectWith name workFn = do
handle - dbConnectTo name
workFn handle `finally` dbDisconnect handle
In this way you avoid finalizers... and everthing is safe providing
Joel Reymont wrote:
How does pattern matching work with HList?
I would like to pass a HList to a function and only match if a
certain field had a certain value.
The code below defines the function foo that accepts a record and
yields one value if the field PtX of the record has the value 0.
David Roundy wrote:
The only solution I can imagine
would be to implement a class for each field name. i.e. the only reasonble
type of f I can imagine is something like
f :: Integral i, RecordHasField_foo i r = r - r
But that's a very complicated solution, and once one implemented that
Bulat Ziganshin wrote:
the following code can't go through typechecking
import Control.Monad.ST
import Data.Array.ST
main = print $ runST $
do arr - newArray (1,10) 127
a - readArray arr 1
writeArray arr 1 216
b - readArray arr 1
Tomasz Zielonka wrote:
I tried to implement another function:
mapChildren :: (forall a. Term f a - Term f a) - Term f b - Term f b
mapChildren fun t@(Lit x) = t
mapChildren fun (IsZero t) = IsZero (fun t)
mapChildren fun (Succ t) = Succ (fun t)
mapChildren fun (If c t e) = If
Tomasz Zielonka wrote:
The papers on GADTs have an example showing how you can transform,
traverse and evaluate ASTs (or terms) with more type safety. I've
used such an approach in one of my applications and it works remarkably
well.
However, I would like to be able to turn off that
[Sorry for possible duplication, our DNS server seems to be broken,
and the sysadm is on vacation]
I don't think that is the problem with GADTs. The following works
untype :: Term f a - Term Untyped ()
untype (Lit x) = Lit x
untype (Succ t) = Succ (untype t)
untype (IsZero t) =
The evaluator of the logic
system is complete: if there is a solution, the evaluator
will always find it in finite time.
Is it also terminating? So if there is no solution it will tell you so.
The evaluator used in the yesterday's message -- no. It is merely
complete; if no solution
Stefan Monnier wrote:
I expected at first you were doing some funky type class molestation
so you can use djinn in your code and let Haskell fill it in.
That has already been done:
De-typechecker: converting from a type to a term
http://www.haskell.org/pipermail/haskell/2005-March/015423.html
John Meacham wrote:
data Type = ForAll [TyVar] Rho -- Forall type
| FunType Type -- Function type
| TyCon TyCon -- Type constants
| TyVar TyVar -- Always bound by a ForAll
with the three synonyms and their constraints being
Stefan Monnier wrote:
instance CpsForm t t where
This can't be right, can it?
In general no: the CPS of a function certainly doesn't fit the above
pattern. So, if the source language has abstractions (the language in
the original message didn't), we have to add another instance for
CpsForm.
Louis-Julien Guillemette wrote:
Say we are using a GADT to represent a simple language of boolean
constants and conditionals,
data Term a where
B:: Bool - Term Bool
Cnd :: Term Bool - Term t - Term t - Term t
and we would like to perform a type-safe CPS conversion over this
Let us consider the following simple code
{-# OPTIONS -fglasgow-exts #-}
module Foo where
data Term a where
B:: Bool - Term Bool
C:: Term Bool - Term t - Term t
I:: Int - Term Int
shw (I t) = (I ++) . shows t
shw (B t) = (B ++) . shows t
shw (C p q) = (Cnd ++) .
Paul Govereau wrote:
BTW, The above program is a translation of an idiomatic use of
functors in ML (pardon my syntax):
module A : sig type t = ... end
module B : funsig(X:SHOW where t = A.t) sig bar : A.t - string end
module C : SHOW where t = A.t
open A
open B(C)
ML modules
Hello!
I'm sure you're aware of the close connection between your FR
stuff (nice) and the foldr/build list-fusion work?
I am now. Indeed, the 'FR' representation of lists is what one passes
to 'build'. Incidentally, the higher-rank type of FR is a
_requirement_ (otherwise, things won't type)
Just to add one more example to Ralf's reply:
We get exactly the same kind of problem if we try
*Main null [fromEnum]
interactive:1:6:
Ambiguous type variable `a' in the constraint:
`Enum a' arising from use of `fromEnum' at interactive:1:6-13
Probable fix: add a type
Ralf Hinze wrote:
To me replacing a GADT by class and instance declarations seems the
wrong way round. We should not forget that the DT in GADT stands for
`data type'.
Francois Pottier enumerated some problems with type inference of GADT
code during his ICFP'05 invited talk. Various
Conor McBride wrote:
Neither Oleg nor Bruno translated my code; they threw away my
structurally recursive on-the-fly automaton and wrote combinator parsers
instead. That's why there's no existential, etc. The suggestion that
removing the GADT simplifies the code would be better substantiated
Conor McBride wrote:
Neither Oleg nor Bruno translated my code; they threw away my
structurally recursive on-the-fly automaton and wrote combinator parsers
instead. That's why there's no existential, etc. The suggestion that
removing the GADT simplifies the code would be better substantiated
Also inspired by Ralf Hinze's post, I thought of removing GADTs from
that code. The result is Haskell98! code, which works well in
Hugs. The code seems to be a bit simpler too. Like the original code,
the function 'parseAny' correctly discriminates between the list of
characters (i.e., strings)
/~oleg/ftp/Computation/Continuations.html#cdr-fstream
especially the reference therein:
Corrado Boehm and Alessandro Berarducci: Automatic Synthesis of Typed
Lambda-Programs on Term Algebras
___
Haskell mailing list
Correction:
We show how to merge two folds into another fold `elementwise'. ... We
need recursive types -- but again, never value recursion.
There is no need for recursive types, actually. Higher-rank types are
still present, which we need for fold anyway. Introducing recursive
types wasn't a
We show how to merge two folds into another fold
`elementwise'. Furthermore, we present a library of (potentially
infinite) ``lists'' represented as folds (aka streams, aka
success-failure-continuation--based generators). Whereas the standard
Prelude functions such as |map| and |take| transform
,
http://pobox.com/~oleg/ftp/Computation/monads.html#fair-bt-stream
First of all, the monad can let succeed the computations that surely
diverge in List and similar monads. As the code at the end of that
file shows, the monad avoids depth-first traps, and can even handle
left-recursion
Benjamin Franksen wrote:
On Thursday 25 August 2005 19:58, Udo Stenzel wrote:
[...] you'll need a type signature somewhere to help ghc resolve
the overloading of newArray and readArray, which is surprisingly
tricky due to the s that must not escape. This works:
compute :: Int - Int
On Thu, Jul 07, 2005 at 07:08:23PM +0200, Tomasz Zielonka wrote:
Some time ago I wanted to return the escape continuation out of the
callCC block, like this:
getCC = callCC (\c - return c)
It seems using shift/reset is better not only in principle but in
practice as well.
module Foo
Jonathan Cast wrote:
] You can't define most initial models without recursive (or
] inductive) data types in general, because initial models are defined
] inductively.
] You can't define head, tail, or foldr using the MonadPlus
] signature
] OK. Right. I forgot about the Church
Regarding the law of mif (aka ifte, aka soft-cut, aka logical
conditional)
mif (mif c t' e') t e = mif c (\x - mif (t' x) t e) (mif e' t e)
You're right of course: mode matters for the predicates that involve
negation, such as mif. However, I believe that the mode is orthogonal
to the
of that derivation is a note `How to take a TAIL of a
functional stream'
http://pobox.com/~oleg/ftp/Computation/Continuations.html#cdr-fstream
The higher-rank type is needed only to express the polymorphic
answertype.
___
Haskell-Cafe mailing list
Haskell-Cafe
on Jun 22 Andrew Bromage wrote about the usefulness of
soft-cuts and don't care non-determinism in non-deterministic
computations in Haskell.
http://www.haskell.org/pipermail/haskell/2005-June/016037.html
Thank you very much for your explanation, it was helpful indeed. You
noted,
Some of the
Daniel Brown wrote:
class Baz a b | a - b
instance Baz (a - b) (a - [b])
instance Baz a a
...but Baz fails with this error...
When confronted with overlapping instances, the compiler chooses the
most specific one (if it is unique), e.g. `Baz (a - b) (a - [b])` is
more specific
program). The CC monad transformer (derived from the CC library by
Sabry, Dybvig, Peyton-Jones), freely available from
http://pobox.com/~oleg/ftp/packages/LogicT.tar.gz
is free from that drawback.
BTW, with that monad transformer, the example looks as follows (again,
in a de-sugared way
: success, failure -- but no cut
continuation. Still, control logical operations are supported. The
continuation-passing implementation was indeed difficult to find,
although the result is deceptively simple.
The code is freely available under the MIT license:
http://pobox.com/~oleg/ftp/packages
Alistair Bayley wrote:
There's a small problem: how to write a factory function that returns values
of various subtypes. The makeSubType function below won't compile, obviously
because the returns types are different (they're not the same 'm').
Indeed, expressions in both branches of an `if'
In this part about zippers with two holes, we discuss the relationship
between zippers and (database) transactions of various isolation
modes. We show the updating enumerator and the corresponding zipper
that maximally preserve sharing and can walk terms with directed
loops. We demonstrate that a
This is the first part of a reply to a query about a zipper with two
foci, posted on this list by Oktaviandi Hadi Nugraha on Apr 13. In
this part we introduce the framework to answer the question.
Our treatment of zipper is quite different from that of Huet (JFP,
1997) and Hinze and Jeuring (JFP
Bryce Bockman wrote:
How would you guys memoize the following code.
simpleCalc :: (Int,Int) - (Int,Int)
simpleCalc (1,l) = (1,l+1)
simpleCalc (x,l) | (odd x) = simpleCalc (((3*x) + 1), 1 + l)
| otherwise = simpleCalc ((x `div` 2), 1 + l)
sCalc x = simpleCalc (x,0)
Benjamin Pierce wrote:
For someone coming to Haskell from an OCaml background, one of the hardest
things to get used to is the somewhat more bare bones module system that
Haskell provides.
...
This works fine as long as what you're exporting is just values, but it's
awkward for types, since
This message presents polymorphic functions that derive a term for a
given type -- for a class of fully polymorphic functions: proper and
improper combinators. This is better understood on an example:
rtest4 f g = rr (undefined::(b - c) - (a - b) - a - c) HNil f g
*HC rtest4 (:[]) Just 'x'
in our case)
http://pobox.com/~oleg/ftp/Haskell/types.html#partial-sigs
But mainly, if we wish to hide some details of the representation, why
not to use tools that are built for that, such as applicative
functors? They are _easily_ implementable in Haskell, arguably
idiomatic, and free from
This message is a literate Haskell98 code for translating proper
linear combinators into a point-free style. That is, we will be
converting (closed, albeit that is not strictly a requirement) terms
of the form ``\x1 ... xn - term'' where each variable xi has at most
one occurrence in term. The
contains the type signature to increase
comprehension:
prod:: (MCompose a b (c - d) e, MCompose f g (b,g) d) =
(h - a) - (c - f) - h - e
prod = (. ((. (,)) . mcomp)) . mcomp
Here `prod' is indeed the categorical product. The second example is
taken from
http://pobox.com/~oleg/ftp
I have been thinking about using Haskell (extended with
higher ranked polymorphism) to demonstrate to my colleagues
some ideas in second-order lambda calculus. It turned out,
however, I am puzzled by the type system myself. So I've
written to seek for help. :)
I started with define Church
Simon Peyton-Jones wrote:
|[ data MyVec a where
|[ MkMyVec :: (Foo a) = a - MyVec a
f x = case x of
MkMyVec x - rhs
constraints are always solved *lazily* when inferring, so we'd infer
f :: Foo [a] = MyVec a - ...
even without any overlap
(extensible) GADT.
The complete new code is included.
Where now? Well, counterexample fiends who want to provoke Oleg into
inventing a new recipe had better write down a higher-order example.
I just did, then deleted it. Discretion is the better part of valour.
It is possible to undelete
On Sun, 2 Jan 2005 [EMAIL PROTECTED] wrote:
I tried to generalize one of my old
packages for quantum *abstract* computations, where state vectors are
defined as functional objects, whose codomain has some arithmetic.
It is easy to see that you can define (f + g) = \x - f x + g x
etc.
The
Ashley Yakeley wrote on the first day of 2005:
This compiled with today's CVS GHC 6.3. I don't think you can do this
without GADTs.
It seems we can do without GADT -- roughly with the same syntax
(actually, the syntax of expressions is identical -- types differ and
we have to write
The operator ($) is often considered an application operator of a
lower precedence. Modulo precedence, there seem to be no difference
between ($) and `the white space', and so one can quickly get used to
treat these operators as being semantically the same. However, they
are not the same in all
Jules Bean wrote:
From the point of view of a programmer, that's all there is to it:
there is no way of proving two functions are the same except by
exhaustively checking every input.
That is too pessimistic, I'm afraid. There is also an intensional
equality. Granted, it can be sound but
Simon Peyton-Jones wrote:
In GHC at present, a separate type signature introduces no scoping. For
example:
f :: forall a. a - a
f x = (x::a)
would be rejected, because the type signature for 'f' does not make
anything scope over the right-hand side, so (x::a) means
Jacques Carette wrote on LtU on Wed, 11/24/2004
] One quick (cryptic) example: the same difficulties in being able to
] express partial evaluation in a typed setting occurs in a CAS
] [computer algebra system]. Of course I mean to have a partial
] evaluator written in a language X for language
Andrew Bromage wrote:
module FD where
class C from to | from - to where
g :: from - to
h :: to - from
instance C Char Bool where
g c = c == 'T'
h b = if b then 'T' else 'F'
--f :: (C Char a) = Char - a
f c = g c
Indeed, functional dependencies are the way to
Jared Warren wrote:
I'm doing some work with heterogeneous sets as provided by the HList
library http://homepages.cwi.nl/~ralf/HList/. My code uses
projections of sets internally and I keep running into the open-world
assumption when I ask the type checker to infer the result of
projections.
It is well known that type classes in Haskell are open. A user may at
any time extend a visible type class by providing a new
instance. There are situations where such an extensibility is
undesirable. We may want to prevent the user from adding an instance
to our class for some specific type --
Jo'n Fairbairn wrote:
The idea is simply that we should provide a mechanism of
saying to a compiler this file (of data) is a module that
exports only the variable v. ...
So we tell the compilation system that file
/somewhere/contains-v contains the value of the variable
v::String, and that
-archive.com/[EMAIL PROTECTED]/msg05186.html
Incidently, some of that is already available in Haskell,
http://pobox.com/~oleg/ftp/Haskell/types.html#partial-sigs
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
data Bar a m = forall t. (MonadTrans t, Monad (t m)) =
Bar (t m a - m a) (t m Int)
data Foo = Foo (forall a m. Monad m = Bar a m)
Is it true that I cannot have a function
foo run op = Foo (Bar run op)
I guess the answer is yes and no. Let's consider the type of 'op':
Andrew Pimlott wrote:
I want values in my existential type to denote, for some monad, a
monadic operation and a way to run the monad. Except, I want it mix
the operation with operations in another monad, so it use a monad
transformer.
I'm afraid, that phrase was a little misleading. It
Dominic Steinitz wrote:
Did you get the first solution to work? When I tried it with hugs -98 I got
Yes, in the process discovering some interesting behavior of
Hugs. Here's the complete code that works with Hugs
module Foo where
class Bits a
instance (Ord a, Bits a, Bounded a, Integral
Tom Pledger wrote:
Something along these lines:
class List l a | l - a where
nil :: l
cons :: a - l - l
But that's not of much use, because there isn't a class method to
recover the elements of a List. We could add more methods (corresponding
to null, head, and tail)
Jules Bean wrote:
Unfortunately, it's not going to work. It's not going to work because
some of the procedures take callbacks, and the callbacks are values of
type IO (). I can see two solutions to this:
a) revert to using an IORef, and use lexical scoping to define my
callbacks in a
I added two lines to your code:
iterate2 f x n | seq f $ seq x $ seq n $ False = undefined
iterate2 f x n = --- as before
rk4Next f h (x, y) | seq f $ seq h $ seq x $ seq y $ False = undefined
rk4Next f h (x, y) = -- as before
I also increased ten times the number of steps for the last
in the context of Scheme,
is available here:
http://pobox.com/~oleg/ftp/Scheme/io.txt
More polished drafts exist, and even a prototype
implementation. Unfortunately, once it became clear that the ideas are
working out, the motivation fizzled.
The discussion of i18n i/o highlighted the need for general
ML is known for its sophisticated, higher-order module system, which
is formalized in Dreyer-Crary-Harper language. A few months ago Ken
Shan showed a complete translation of that language into System Fw:
http://www.eecs.harvard.edu/~ccshan/xlate/
Ken Shan has concluded that languages
Martin Sulzmann stated the goal of the append exercise as follows:
] Each list carries now some information about its length.
] The type annotation states that the sum of the output list
] is the sum of the two input lists.
I'd like to give a Haskell implementation of such an append
function,
We show the Haskell implementation of keyword arguments, which goes
well beyond records (e.g., in permitting the re-use of
labels). Keyword arguments indeed look just like regular, positional
arguments. However, keyword arguments may appear in any
order. Furthermore, one may associate defaults
Simon Peyton-Jones wrote:
kind HNat = HZero | HSucc HNat
class HNatC (a::HNat)
instance HNatC HZero
instance HNatC n = HNatC (HSucc n)
There is no way to construct a value of type HZero, or (HSucc HZero);
these are simply phantom types. ... A merit of
Hello!
Bjorn Lisper wrote:
What is the relation to the sized types by Lars Pareto and John Hughes?
It is orthogonal and complementary, as the message in response to
Conor T. McBride indicated.
What is the relation to classical range analyses for (e.g.) array index
expressions, which have
the link to
the code:
http://pobox.com/~oleg/ftp/Haskell/number-param-vector-code.tar.gz
I should emphasize that all proper examples use genuine Haskell arrays
rather than nested tuples. Yet the type of the array includes its
size, conveniently expressed in decimal notation. One can specify
Malcolm Wallace wrote:
and since you cannot write a partial signature,
Can't we really?
It seems `partial signature' means one of two things:
- we wish to add an extra constraint to the type of the function
but we don't wish to explicitly write the type of the
There is a view that in order to gain static assurances such as an
array index being always in range or tail being applied to a
non-empty list, we must give up on something significant: on data
structures such as arrays (to be replaced with nested tuples), on
general recursion, on annotation-free
Ben Yu wrote:
class Rule r u u' m where
apply :: r - u - m u'
data And = And
data Bin a b o = Bin a b o
instance (Monad m, Rule r1 u u' m, Rule r2 u' u'' m) =
Rule (Bin r1 r2 And) u u'' m where
apply (Bin r1 r2 _) u = apply r1 u = apply r2
Ghc complains about Could not
Is it possible to return an arbitrary unboxed array that was
constructed in the ST monad (as an STUArray)?
The issue is that you end up with a MArray class constraint that
involves the state thread's 's' parameter, but this type
variable gets
S. Alexander Jacobson wrote:
Also, is there a way to get the typesystem to
tell you which functions may fail i.e. which
functions have failMsg as an implicit parameter?
Generally speaking, that is not that easy. If we have a functional
composition (foo . bar), we wish its
401 - 500 of 588 matches
Mail list logo