Hello,
On Thu, Aug 20, 2009 at 16:54, Max Desyatov explicitc...@googlemail.comwrote:
Sean Leather leat...@cs.uu.nl writes:
I'm not sure the problem you're running into is strictly a generic
programming (GP) one. Typically, GP takes code that is often written
and generalizes it, so that
Antoine == Antoine Latter aslat...@gmail.com writes:
Antoine On Thu, Aug 20, 2009 at 8:58 AM, Colin Paul
Antoine Adamsco...@colina.demon.co.uk wrote:
Hello,
I'm trying to find the API documentation for happstack 0.3
(online is for 0.2).
So I did:
On Fri, Aug 21, 2009 at 5:03 AM, David Menendez d...@zednenem.com wrote:
On Thu, Aug 20, 2009 at 6:57 PM, Peter Verswyvelenbugf...@gmail.com
wrote:
On Thu, Aug 20, 2009 at 11:23 PM, David Menendez d...@zednenem.com
wrote:
The important things to note are (1) getChar# depends on the
From: haskell-cafe-boun...@haskell.org
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Bulat Ziganshin
To: Peter Verswyvelen
But how does GHC implement the RealWorld internally? I guess
look the base library sources for RealWorld
IO also seems to use unboxed (hence strict?) tuples
newtype IO a = IO (State# RealWorld - (# State# RealWorld, a #))
Not sure if this is just for performance, but if the strictness is required,
here we have the horrible hack again then (would behave different without
it?). I guess it works
Internally GHC does have to enforce the ordering on IO operations somehow.
If there actually was a RealWorld value being passed around you could
use some version of seq the guarantees sequential evaluation.
But GHC doesn't even pass a RealWorld around, the sequencing is
enforced by different
You need a lot of magic to make the IO monad efficient.
You don't really want to pass around (and pattern match on) a
RealWorld token, that would be inefficient.
On Fri, Aug 21, 2009 at 11:04 AM, Peter Verswyvelenbugf...@gmail.com wrote:
IO also seems to use unboxed (hence strict?) tuples
Actually GHC *does* pass around a RealWorld token right through the optimiser.
Just at the moment of code generation we drop it, so that it's not *actually*
passed. But for almost all of compilation it's just as if it *was*.
Simon
| -Original Message-
| From:
Heinrich Apfelmus wrote:
Job Vranish wrote:
I've been in a situation a lot lately where I need to keep a collection of
values, and keep track of them by a persistent index.
module Store (Key, Store, empty, add, delete, lookup) where
newtype Key = Key { int :: Int }
empty ::
Hello,
We're working on a Haskell binding to levmar[1] a C implementation of
the Levenberg-Marquardt optimization algorithm. The
Levenberg-Marquardt algorithm is an iterative technique that finds a
local minimum of a function that is expressed as the sum of squares of
nonlinear functions. It has
Daniel Fischer wrote:
Bad bug in Parsec (from the beginning, the same happens in parsec-2), I'd
say.
I'd say, its a feature. lookAhead returns whatever its argument returns.
So in this case it returns Consumed without consuming.
In that case, the comment
lookAhead p parses p without
{-# LANGUAGE UndecidableInstances #-}
Ouch!
Don't worry, it's just me not liking UndecidableInstances.
So instead of passing the parameters as a list I want to pass them as
arguments:
\x p1 p2 p3 - p1*x^2 + p2*x + p3
Why not use tuples?
\x (p1, p2, p3) - p1 * x^2 + p2 * x + p3
Or a
Thanks for your replies.
Job Vranish wrote:
Martijn, how did you encounter this problem?
My list of input symbols contains some extra information and I was using
lookahead to query for that information before doing the actual parsing.
I was using it in various places, including a list of
On Fri, Aug 21, 2009 at 5:04 AM, Lennart
Augustssonlenn...@augustsson.net wrote:
On Fri, Aug 21, 2009 at 10:52 AM, Bayley, Alistair
alistair.bay...@invesco.com wrote:
From: haskell-cafe-boun...@haskell.org
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Bulat Ziganshin
To: Peter
On Fri, Aug 21, 2009 at 2:02 PM, Miguel Mitrofanovmiguelim...@yandex.ru wrote:
{-# LANGUAGE UndecidableInstances #-}
Ouch!
Don't worry, it's just me not liking UndecidableInstances.
Without it, GHC doesn't like the 'Arg f ~ b' constraint not being
smaller than the instance head in:
instance
Thanks for all the input! :)
My current code (unfinished) is here:
http://github.com/jvranish/IndexedCollection/tree/master
but I think I'll shorten the names as you suggest. (and add some strictness
to availableKeys)
I also added an extra phantom type parameter to the collection (and key) so
I'm pretty sure you're going to need an existential wrapper for your
fromList function. Something like:
data AnyVector a where
AnyVector :: Vector a n - AnyVector a
because otherwise you'll be returning different types from
intermediate iterations of your fromList function.
I was playing with
Don't worry, it's just me not liking UndecidableInstances.
Without it, GHC doesn't like the 'Arg f ~ b' constraint
He's probably right. I don't like it either.
What will the type of 'levmarHL' look like using tuples or using your
special list-like type?
I guess it would be something like
On Aug 21, 2009, at 5:11 PM, Job Vranish wrote:
I also added an extra phantom type parameter to the collection (and
key) so that I can prevent keys from being used on different
collections even if they hold elements of the same type.
I have the impression that this requires explicit type
Hi
I'm sure it won't be to everyone's taste, but here's what
SHE makes of this problem. SHE lives here
http://personal.cis.strath.ac.uk/~conor/pub/she
{-# OPTIONS_GHC -F -pgmF she #-}
{-# LANGUAGE GADTs, KindSignatures, TypeOperators, TypeFamilies,
FlexibleContexts,
On Fri, Aug 21, 2009 at 4:37 AM, Peter Verswyvelenbugf...@gmail.com wrote:
On Fri, Aug 21, 2009 at 5:03 AM, David Menendez d...@zednenem.com wrote:
I'm not sure I understand your question, but I think it's possible to
use interact in the way you want. For example, this code behaves
correctly
On Fri, Aug 21, 2009 at 4:41 AM, Bas van Dijkv.dijk@gmail.com wrote:
My single question is: how can I convert a list to a Vector???
fromList :: [b] - Vector b n
fromList = ?
A simpler thing to help you see why this is such a problem is, the
problem of how to get a type level natural from
Hi, reading a previous thread I got interested.
I simplified the example pointed by dons in
import Control.Parallel
main = a `par` b `pseq` print (a + b )
where
a = ack 3 11
b = ack 3 11
ack 0 n = n+1
ack m 0 = ack (m-1) 1
ack m n = ack (m-1) (ack m (n-1))
compiled with
thank you very much Job.
Regards,
Kashyap
On Thu Aug 20th, 2009 1:13 PM EDT Job Vranish wrote:
Opps:
setPixel = State setPixel'
should be:
setPixel x y rgb = State $ setPixel' x y rgb
- Job
On Thu, Aug 20, 2009 at 1:05 PM, Job Vranish jvran...@gmail.com wrote:
Your setPixel function is
paolo.veronelli:
Hi, reading a previous thread I got interested.
I simplified the example pointed by dons in
import Control.Parallel
main = a `par` b `pseq` print (a + b )
where
a = ack 3 11
b = ack 3 11
ack 0 n = n+1
ack m 0 = ack (m-1) 1
ack m n = ack
On Fri, Aug 21, 2009 at 1:03 PM, Jason Dagitda...@codersbase.com wrote:
Even with a type class for our type level numbers I'm at a loss. I
just don't understand how to convert an arbitrary int into an
arbitrary but fixed type. Perhaps someone else on the list knows. I
would like to know,
Just to expand on David's higher-order function for the original
Vector type, we can do:
data AnyVec a where
AnyVec :: Vec a n - AnyVec a
listToVec :: [a] - AnyVec a
listToVec = worker AnyVec
worker :: (forall n. Nat n = Vec a n - t) - [a] - t
worker f [] = f Nil
worker f (x:xs) = worker (f .
A better test program
import Control.Parallel
main = a `par` b `pseq` print (a + b )
where
a = ack 3 11
b = fib 39
ack 0 n = n+1
ack m 0 = ack (m-1) 1
ack m n = ack (m-1) (ack m (n-1))
fib 0 = 0
fib 1 = 1
fib n = fib (n-1) + fib (n-2)
running it , these are the results
It only requires type annotations on your uses of empty (as that is the only
way to construct a collection). The phantom type sticks to everything after
that.
If you don't care to add a signature then things still work just fine, you
just won't be prevented from using indexes from the wrong
paolo.veronelli:
A better test program
import Control.Parallel
main = a `par` b `pseq` print (a + b )
where
a = ack 3 11
b = fib 39
ack 0 n = n+1
ack m 0 = ack (m-1) 1
ack m n = ack (m-1) (ack m (n-1))
fib 0 = 0
fib 1 = 1
fib n = fib (n-1) + fib (n-2)
For some reason I never saw David's reply to my email.
On Fri, Aug 21, 2009 at 11:16 AM, Daniel Peeblespumpkin...@gmail.com wrote:
Just to expand on David's higher-order function for the original
Vector type, we can do:
data AnyVec a where
AnyVec :: Vec a n - AnyVec a
listToVec :: [a] -
Thanks for all the advice.
I have this so far. Unfortunately I have to use unsafeCoerce:
-
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
module LevMar where
On Fri, Aug 21, 2009 at 8:50 PM, Jason Dagitda...@codersbase.com wrote:
toPeano :: Int - (forall n. Nat n = n - t) - t
This looks a bit more promising. For those unfamiliar with this form,
it is the logical negation of the previous type. One description is
here [1], where it is mentioned
Hi Bas,
I haven't looked at your code too carefully, but unsafeCoerce amounts
to proof by violence :) If you want to construct a (much more verbose,
probably) real proof of your constraints, you might want to refer to
Ryan Ingram's email[1] from a few months ago about lightweight
dependent(-ish)
On Fri, Aug 21, 2009 at 6:53 PM, David Menendez d...@zednenem.com wrote:
You would still need to determine whether you've reached EOF or not,
which forces the input to be determined up to the first line-break or
EOF.
Good point! I actually had it on my TODO list, but that settles it then :)
On Fri, Aug 21, 2009 at 2:50 PM, Jason Dagitda...@codersbase.com wrote:
On Fri, Aug 21, 2009 at 2:03 PM, David Menendezd...@zednenem.com wrote:
The problem is that the parameter, n, is part of the input to toPeano,
but you need it to be part of the output. To rephrase slightly, you
have
On Fri, Aug 21, 2009 at 3:29 PM, Peter Verswyvelenbugf...@gmail.com wrote:
On Fri, Aug 21, 2009 at 6:53 PM, David Menendez d...@zednenem.com wrote:
Some people dislike seq because it lets you force strictness
in cases where pattern matching cannot (like function arguments), but
hardly anyone
The question is, in this case when the user gets to see a bit too much of
the output before he sees the input, if that really qualifies as an
incorrect program. It's a bit in the gray zone I guess. You could even
argue that it's a feature that input and output are not really synched, they
are
typo, sees the input = must enter the input
On Fri, Aug 21, 2009 at 10:28 PM, Peter Verswyvelen bugf...@gmail.comwrote:
The question is, in this case when the user gets to see a bit too much of
the output before he sees the input, if that really qualifies as an
incorrect program. It's a bit in
I'm forwarding this to haskell-cafe to catch any current or new
Boston-area Haskellers who haven't yet joined the BostonHaskell Google
group: http://groups.google.com/group/bostonhaskell
If you're interested in Boston-area Haskell activity, please join the
Google group so you won't miss out on
Hi, I'm just started to learn Haskell. Coming from a programming contest
background (where it is important to be able to solve problems in a small
amount of code) I'm wondering what the best way is for simple IO.
A typical input file (in a programming contest) is just a bunch of numbers
which
G.C.Stavenga:
Hi, I'm just started to learn Haskell. Coming from a programming contest
background (where it is important to be able to solve problems in a small
amount of code) I'm wondering what the best way is for simple IO.
A typical input file (in a programming contest) is just a
From: David Menendez d...@zednenem.com
or, equivalently, by using a higher-order function.
toPeano :: Int - (forall n. Nat n = n - t) - t
Incidentally, this is the approach used in the type-level library [1],
which provides the function:
reifyIntegral :: Integral i = i - (forall n.
The IO in hbc was (is) the old request-response model, on top of which
there was also a continuation layer, as well as the monadic IO (once
that was invented). It involved a lot more C code handling the
requests than I really liked.
BTW, unsafePerformIO is pretty ugly to implement in the
Don Stewart-2 wrote:
G.C.Stavenga:
Hi, I'm just started to learn Haskell. Coming from a programming contest
background (where it is important to be able to solve problems in a small
amount of code) I'm wondering what the best way is for simple IO.
A typical input file (in a
Does anyone know of any papers or projects, either for Haskell or any
other language, that relate to what I am going to attempt to describe in
the following:
Go to any paper or book that includes some amount of calculation type
mathematics. An example is the formula in the Description section
On Fri, Aug 21, 2009 at 11:42 PM, Stavenga, G.C. g.c.stave...@uu.nl wrote:
Hi, I'm just started to learn Haskell. Coming from a programming contest
background (where it is important to be able to solve problems in a small
amount of code) I'm wondering what the best way is for simple IO.
A
The purpose of mathematic syntax is to comunicate mathematical ideas
between humans. Programmirng languages both communicate mathmatical
ideas among humans and specify sequences of operations performed by
computing machinery to achieve a goal. The trouble is is the first
goal is often
Let me put all my cards on the table. You see, I really am only
slightly irrigated by offset syntax. In contrast, I am a strong
proponent of functional programming for parallel programming. In my
opinion, it has to be the new way for multiprocessor machines. Just
think about it and if other
49 matches
Mail list logo