Quoting Matthew Steele mdste...@alum.mit.edu:
{-# LANGUAGE Rank2Types #-}
class FooClass a where ...
foo :: (forall a. (FooClass a) = a - Int) - Bool
foo fn = ...
newtype IntFn a = IntFn (a - Int)
bar :: (forall a. (FooClass a) = IntFn a) - Bool
bar (IntFn fn)
Quoting Matthew Steele mdste...@alum.mit.edu:
1) bar ifn = case ifn of IntFn fn - foo fn
2) bar ifn = foo (case ifn of IntFn fn - fn)
I can't help feeling like maybe I am missing some small but
important piece from my mental model of how rank-2 types work.
As SPJ suggested, translation to
Quoting Wolfgang Jeltsch g9ks1...@acme.softbase.org:
Am Mittwoch, den 28.12.2011, 12:48 + schrieb Simon Peyton-Jones:
Only that BOX is a sort (currently the one and only sort), whereas
Constraint is a kind. I'm not sure that BOX should ever be displayed
to users.
Okay, this makes sense
On Wed, Mar 16, 2011 at 12:05:56PM +, Andrew Coppin wrote:
withContainer ∷ (∀ s. Container s → α) → α
Hmm, yes. That will work, but I wonder if there's some way of doing
this that doesn't limit the scope of the container to one single
span of code...
You can just pack the container into
On Sat, Jan 22, 2011 at 12:40:04AM -0500, Ryan Newton wrote:
On Wed, Nov 10, 2010 at 11:33 AM, Lauri Alanko l...@iki.fi wrote:
So a naive implementation of split would be:
split g = (mkGen seed, g')
where (seed, g') = random g
Just to be clear, that is the same as Burton Smith's
On Thu, Dec 30, 2010 at 02:20:34PM +1030, Mark Spezzano wrote:
5.3 BOUND:
=
If E1 = \x.xy then x is bound
If E2 = \z.z then is not even mentioned
So E = E1 E2 = (\x.xy)(\z.z) = (\z.z)y -- Error: x is not bound but
should be by the rule of 5.3
Your final = here is beta equality.
On Thu, Dec 30, 2010 at 07:04:11AM -0600, Larry Evans wrote:
On 12/29/10 22:40, Daryoush Mehrtash wrote:
Why do people put ; in do {}, or , in data fields, at the
beginning of the line?
--
It reflects the parse tree better by putting the
combining operators (e.g. ';' and ',') at the
On Thu, Dec 30, 2010 at 10:39:29AM -0600, Larry Evans wrote:
Lauri, I assume then that you want to draw special attention to
the return type instead of the first argument type.
Only to the fact that the return type is of a different nature than
the argument types, and that all the argument
On Tue, Dec 21, 2010 at 08:31:08AM -0700, Jonathan Geddes wrote:
I'd love for the compiler to give an error (or maybe just a warning)
in the case that I have a pattern match in a monad that just blows up
(throws an exception) on a pattern match failure.
You will be interested to know that
On Thu, Nov 11, 2010 at 07:04:16PM +1030, John Lask wrote:
it is often desirable to have the same field names
for many records in the same module.
very much so, this is currently possible, with the restriction that
the field names must have the same type modulo the record it is
selecting on.
On Thu, Nov 11, 2010 at 03:17:39PM +0200, Michael Snoyman wrote:
data PetOwner
data FurnitureOwner
data Cat = Cat { owner :: PetOwner }
data Chair = Chair { owner :: FurnitureOwner }
These are clearly related uses, so as I said, you can use a type class
to overload the accessor name in a
On Thu, Nov 11, 2010 at 04:04:07PM +, Aaron Gray wrote:
On 11 November 2010 11:43, Petr Pudlak d...@pudlak.name wrote:
Thanks Dan, the book is really interesting, all parts of it. It looks like
I'll read the whole book.
Watch out for the decidability issue though :-
On Wed, Nov 10, 2010 at 11:59:28AM +0200, John Smith wrote:
http://hackage.haskell.org/trac/haskell-prime/wiki/TypeDirectedNameResolution
The problem with this is that it conflates two orthogonal features:
type-directed name resolution proper (also known as ad hoc
overloading), and a fancy
On Thu, Nov 04, 2010 at 05:38:12PM +, Simon Peyton-Jones wrote:
There's lots of material on generators that generate a linear
sequence of random numbers, but much less on how to generate a tree
of random numbers, which is what Haskell's System.Random API
requires.
I'd like to understand
On Thu, Oct 28, 2010 at 01:55:12PM -0700, Don Stewart wrote:
The number of subscribers to the Haskell Reddit, for example, is double
the -cafe@, and there are comparable numbers of questions being asked on
the Stack Overflow [haskell] tag, as here -- so anyone who only reads
-cafe@ is already
On Mon, Oct 25, 2010 at 10:10:56PM +0100, Andrew Coppin wrote:
Type theory doesn't actually interest me, I just wandered what the
hell all the notation means.
That sounds like an oxymoron. How could you possibly learn what the
notation means without learning about the subject that the notation
On Thu, Oct 07, 2010 at 02:45:58PM -0700, Nicolas Pouillard wrote:
On Thu, 07 Oct 2010 18:03:48 +0100, Peter Wortmann sc...@leeds.ac.uk wrote:
Might be off-topic here, but I have wondered for a while why Haskell
doesn't support something like follows:
do case (- m) of ...
With the
On Sun, Jun 21, 2009 at 05:53:04PM +0100, Andrew Coppin wrote:
I've written a simple interpretter that takes any valid Lambda
expression and performs as many beta reductions as possible. When the
input is first received, all the variables are renamed to be unique.
Question: Does this
On Tue, May 26, 2009 at 09:10:10PM +0200, Matthias Görgens wrote:
The model in Prolog, however, looks more like the model used in most
strict functional languages. It uses impure predicates to affect the
outside world. Do you know of any attempt to do for logic programming
what Monads did
On Tue, May 12, 2009 at 04:59:36PM -0400, Xiao-Yong Jin wrote:
f :: a - b
g :: (a - b) - c - d
gf :: c - d
gf = g f
Now I want to handle exceptions in f and redefine f as in f'
f' :: a - IO (Either e b)
So my question is how to define gf' now to use f' instead of
f?
gf' ::
On Fri, Jan 23, 2009 at 08:10:38PM -0500, rocon...@theorem.ca wrote:
I'd like to argue that laws, such as monoid laws, do not apply to partial
values. But I haven't thought my position through yet.
Before you do, you may want to read Fast and Loose Reasoning is
Morally Correct:
On Sun, Jan 04, 2009 at 04:19:38PM +0800, Evan Laforge wrote:
If you don't have set-car!, then identity and equality are impossible
to differentiate.
There's still eqv?. (I wish people wouldn't use eq? as an example of
an identity-comparison operation. It's as underdefined as
unsafePtrEq.)
So
On Tue, May 20, 2008 at 09:15:57AM +0100, Yann Golanski wrote:
1- Get a list out of a file: I managed to do that using the following:
parseImageFile :: FilePath - IO [String]
parseImageFile file = do inpStr - readFile file
return $ filter (/=) (breaks (=='\n')
On Tue, May 20, 2008 at 07:54:33AM +0200, Zsolt SZALAI wrote:
Here comes IO and one-way monads, where the internal state can not be
extacted, and seems, that the internal data is global to the program.
Hows that could be? Is it just because main::IO() or because the
implementation of IO uses
On Wed, May 14, 2008 at 03:59:23PM +0100, Edsko de Vries wrote:
You mention that a direct implementation of what I suggested would
break the monad laws, as (foo) and (Let foo id) are not equal. But one
might argue that they are in fact, in a sense, equivalent. Do you reckon
that if it is
Please note that if you're using GHC, bang patterns are often much
more convenient than $! or seq when you want to enforce strictness:
http://www.haskell.org/ghc/docs/latest/html/users_guide/bang-patterns.html
Lauri
___
Haskell-Cafe mailing list
If compositionality is important, at least Rabin's fingerprints are
worth considering: http://citeseer.ist.psu.edu/broder93some.html
They have the neat property that the fingerprint of a concatenation of
strings can be cheaply computed from the fingerprints of the
constituents. I think this
On Tue, Sep 11, 2007 at 07:33:54AM -0700, Greg Meredith wrote:
Our analysis suggested the following breakdown
- Structural reflection -- all data used in the evaluation of programs
has a programmatic representation
- Procedural reflection -- all execution machinery used in the
On Thu, Aug 02, 2007 at 02:08:33PM -0700, David Roundy wrote:
This would be a very nice type to have (natural numbers), but is a tricky
type to work with. Subtraction, for instance, wouldn't be possible as a
complete function...
Of course it would. It would just have the type Nat - Nat -
On Mon, Jul 30, 2007 at 02:40:35PM -0700, Chad Scherrer wrote:
Given a list, say [1,2,3], I'd like to be able to generate an infinite
list of random elements from that list, in this case maybe
[1,2,1,3,2,1,3,2,3,1,2,...]. I'm using IO for random purely due to
laziness (my own, not Haskell's).
On Wed, Mar 01, 2006 at 11:53:42AM +, Simon Marlow wrote:
something along these lines is likely to be quite straightforward to
implement, won't require any changes to the type system, and gives you
a useful form of implicit parameters without any of the drawbacks.
The main difference
and piping processes would fill this description, but I don't
think such a thing exists. Yet I do have a vague recollection that
there are some existing DSLs that can be used in such a way. Does
anyone have suggestions?
Thanks.
Lauri Alanko
[EMAIL PROTECTED
(or a generalization thereof), since
one can always use stToIO if operation in the IO monad is really
required.
Lauri Alanko
[EMAIL PROTECTED]
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell
this helps.
Lauri Alanko
[EMAIL PROTECTED]
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
it extremely convenient that I can write purely
imperative code with a simple syntax like do { foo; bar; baz }. I'd
like similar simplicity when dealing with arrows, too.
Lauri Alanko
[EMAIL PROTECTED]
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED
in the environment. Some schemes do, though.)
Lauri Alanko
[EMAIL PROTECTED]
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
on whether it was already bound.
Lauri Alanko
[EMAIL PROTECTED]
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
in Haskell, apart from existentials
and Dynamic? Ordinary type class dispatch is all done based on the types of
variables, not their values. All the dispatching could even be done at
compile time by specializing everything...
Lauri Alanko
[EMAIL PROTECTED
haven't yet managed to write up a more lucid
exposition of the issue...)
Lauri Alanko
[EMAIL PROTECTED]
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
and static types.
Strangely enough, I haven't found any real research on this particular
subject. There's lots of work on related areas, eg. dynamic types and
intensional polymorphism, but nothing that's really motivated by eval
and reflection.
Any suggestions for references are welcome. :)
Lauri
and predictable
typing is important, and it's ok for things to look funny because,
after all, funny things _are_ going on when special optimizations are
applied.
Lauri Alanko
[EMAIL PROTECTED]
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http
for module A.B.C? Then you don't need to have a
long, mostly empty dummy hierarchy.
Lauri Alanko
[EMAIL PROTECTED]
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
. With heavy specialization, of course. This would be
especially useful if the FFI (especially withCString) supported it.
Or alternatively, maybe the foldr/build rewriting trick could be used to
eliminate some redundant conversions between representations?
Just throwing ideas in the air here.
Lauri Alanko
. For right-associative ones (such as the function arrow), the
One True Way is this:
Handle -
Ptr a -
Int -
IO ()
Nuff said.
Lauri Alanko
[EMAIL PROTECTED]
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http
sources.
If you find yourself using one of these programs, could you please check
your configuration or maybe consider switching to a more well-behaving
user agent? This would make your messages much easier to follow.
Thanks.
Lauri Alanko
[EMAIL PROTECTED
On Thu, May 02, 2002 at 02:12:53PM +0400, Serge D. Mechveliani wrote:
Please, has Haskell e :: Double
( ~= limit (1 + 1/n)^n ) in its standard library?
exp 1.0
Lauri Alanko
[EMAIL PROTECTED]
___
Haskell mailing list
[EMAIL PROTECTED]
http
:
case (compare k k') of LT - ... ; GT - ... ; EQ - ...
This might even be faster if comparison is expensive.
Lauri Alanko
[EMAIL PROTECTED]
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
(Lift z) = z
runTerm (a : b) = runTerm a runTerm b
-- ...
I never actually pursued this idea to the end, though, so I don't know
if this would be useful in practice. But still, it's a neat idea, and
gives a reason why const should be in a class. :)
Lauri Alanko
[EMAIL PROTECTED
errors, when the implementation doesn't follow the expected (but
non-language-enforceable) semantics.
Lauri Alanko
[EMAIL PROTECTED]
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell
for
days trying to compile ghc with a _working_ ghci on this solaris
machine... it took literally a minute to build hugs. :)
Lauri Alanko
[EMAIL PROTECTED]
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow
Skipping Tst ( Tst.hs, ./Tst.o )
Ok, modules loaded: Tst.
Tst Cons Foo Nil
Cons Foo Nil
Tst len (Cons foo Nil)
1
So it's clearly something with the interpreter.
Lauri Alanko
[EMAIL PROTECTED]
___
Glasgow-haskell-bugs mailing list
[EMAIL
as
a alone, but this is just wishful thinking...)
Secondly, the :m command in ghci does not accept underscores in module names.
Both are still present in CVS as of May 29th.
Lauri Alanko
[EMAIL PROTECTED]
___
Glasgow-haskell-bugs mailing list
[EMAIL
On Fri, May 11, 2001 at 02:14:24PM +0200, Marcin 'Qrczak' Kowalczyk wrote:
On Fri, 11 May 2001, Lauri Alanko wrote:
Why? This makes composing and subtyping impossible:
instance (MonadTrans t, MonadState s m, Monad (t m))
= MonadState s (t m) where
get = lift get
put
-unstable, linux
2.4.4, glibc-2.2.2, gcc-2.95.4 and redhat 6.1, linux-2.2.19, glibc-2.1.3,
egcs-1.1.2.
Prithee, somebody fix this, I would _so_ love to migrate from hugs and get
all the yummy ghc extensions and hslibs when using an interpreter. :)
Lauri Alanko
[EMAIL PROTECTED
54 matches
Mail list logo