On Fri, 2008-06-06 at 15:41 -0700, Klaus Ostermann wrote:
Why does the code below not pass the type checker?
If I could explictly parameterize y with the type constructor Id (as e.g. in
System F), then 'y Id' should have the type Int - Int
and hence y Id x should be OK, but with Haskell's
Monads in Haskell are a topic that I, like most beginners, find
difficult and mind-twisting. Now that I think I understand monads,
they seem to be very simple; I've read that this is a common
experience.
So I wonder, what would it take to help beginners catch on with a
minimum of fuss or
I'll try to keep this going. I think it's a good idea.
See you in the fall!
Jon
Asumu Takikawa wrote:
Hi. I'd be interested in a meeting like this, but unfortunately since
UBC is done for winter term I'm out of Canada for the summer. If anyone
organizes a meet-up come fall I'd happily
On Fri, Jun 6, 2008 at 4:41 PM, Klaus Ostermann [EMAIL PROTECTED] wrote:
type Id a = a
x :: Id Int
x = undefined
y :: (a Int) - (a Int)
y = undefined
In a Int, a refers to any type constructor, not any type function.
So the best you can do is:
newtype Id a = Id a
-- rest as before
Luke
On Fri, Jun 06, 2008 at 03:41:07PM -0700, Klaus Ostermann wrote:
Why does the code below not pass the type checker?
If I could explictly parameterize y with the type constructor Id (as e.g. in
System F), then 'y Id' should have the type Int - Int
and hence y Id x should be OK, but with
type declarations are not first-class; treat them more like macro
expansions. In particular, you cannot make a function polymorphic
over a type declaration.
You can make this typecheck using a data or newtype declaration for Id:
newtype Id x = Identity x
(or)
data Id x = Identity x
You do need
Hello,
I was just brushing my haskell-fu skills writing a solution for Google
Treasure Hunt Problem 4. Hers is what it looks like:
primes = sieve [2..]
where
sieve (p:xs) = p : sieve [x | x - xs, x `mod` p /= 0]
sumOf n l = sum (take n l) : sumOf n (tail l)
find l = foldl1 aux l
short answer: use newtype instead of type (and check the
language spec for the difference between the two).
Why does the code below not pass the type checker?
because of the type error?-) seriously, though, it is useful to
accompany such questions with some indication of what you're
trying to
Patrick Perry wrote:
Xiao-Yong Jin wrote:
Apart from some warnings, the library compiles fine in my
system. But there is a minor issue about the library it
links against when `./Setup test'. I need to use `-lcblas'
instead of `-lblas' to get it to link to correct libraries.
I don't know
On Fri, Jun 6, 2008 at 8:35 PM, Andrew Coppin
[EMAIL PROTECTED] wrote:
import Text.ParserCombinators.Parsec as P
Now I only have to write P.runPaser, which is much shorter.
Or maybe even
import Text.ParserCombinators.Parsec as Parser
and then `Parser.run'.
Having the module hierarchy be
I'm getting errors (see below) trying to build the tests in
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mersenne-random-0.1.1
I built the package itself using
./Setup configure -f use_sse2
I thought I had an intel core duo (also see below). I think I may be
missing a library but
Ronald Guida wrote:
Thank you, apfelmus. That was a wonderful explanation; the debit
method in [1] finally makes sense.
A diagram says more than a thousand words :)
My explanation is not entirely faithful to Okasaki, let me elaborate.
In his book, Okasaki calls the process of transferring
On Friday 06 June 2008, Andrew Coppin wrote:
It's really quite frustrating that it is 100% impossible to write a
single function that will process lists, arrays, sets, maps, byte
strings, etc. You have to write several different versions. OK, so some
functions really don't make sense for a set
Andrew Coppin wrote:
Until very recently, it was not at all clear to me that there is
actually a very simple solution to this problem:
import Text.ParserCombinators.Parsec as P
Now I only have to write P.runPaser, which is much shorter.
This fact probably needs to be mentioned more loudly -
I found that I often need predecessor and successor of some key in
Data.Map.Map. Just like that:
predKey, succKey :: Ord k = Data.Map.Map k a - k - Maybe k
predKeyElem, succKeyElem :: Ord k = Data.Map.Map k a - k - Maybe (k,a)
Data.Map has operations like that on key indexes, but it is
On 7 Jun 2008, at 08:05, Ronald Guida wrote:
What made monads click for me is when I understood the following
things:
Well, in case anybody's interested, I didn't know anything about
monads before I tried to read the book Toposes theory (not sure
about the exact name, I've read it in
On Saturday 07 June 2008, Ronald Guida wrote:
3. These closures are extremely similar to the closures that arise
when desugaring let-syntax.
let x1 = f1 inf1 -$ (\x1 - Where:
let x2 = f2 in f2 -$ (\x2 - (-$) :: a - (a - b) - b
let x3 = f3 in
Hi,
I had private conversation with Andrzej Jaworski about the
fact that his reply to Alberto Ruiz's post is off thread.
What he did was clicking on the mailto link beside the
author's name on the list archive web page [1].
[1] http://www.haskell.org/pipermail/haskell-cafe/2008-June/044023.html
On Fri, Jun 6, 2008 at 2:35 PM, Andrew Coppin
[EMAIL PROTECTED] wrote:
Johan Tibell wrote:
3. Lack of common interfaces.
Yes.
It's really quite frustrating that it is 100% impossible to write a single
function that will process lists, arrays, sets, maps, byte strings, etc. You
have to
2008/6/6 Andrew Coppin [EMAIL PROTECTED]:
Until very recently, it was not at all clear to me that there is actually a
very simple solution to this problem:
import Text.ParserCombinators.Parsec as P
Now I only have to write P.runPaser, which is much shorter.
Err, I have a beginner question,
I had a problem installing happy 1.17 (same result with happy head).
This appears to be required for installing happs-hsp-template via
cabal install.
thanks for any advice!
Thomas.
*
[EMAIL PROTECTED]:~/haskellInstalls/smallInstallsdarcs get
--partial http://darcs.haskell.org/happy/
as promised,
sudo cabal install plugins
works out of the box now. that's nice :)
thomas.
2008/6/6 Duncan Coutts [EMAIL PROTECTED]:
Hi everyone,
== Cabal-1.4 release candidate ==
The second release candidate of Cabal-1.4 is out:
http://haskell.org/cabal/download.html
Please test and
{--
I try to define class Store that will group types implmenting different
storage mechanisms .
All types should support two functions:
1) put (key, value) pair into storage
2) get value from storage corresponding to the given key
As an example I start with the following storage types:
--}
--
On Sat, 2008-06-07 at 00:05 -0400, Ronald Guida wrote:
Monads in Haskell are a topic that I, like most beginners, find
difficult and mind-twisting. Now that I think I understand monads,
they seem to be very simple; I've read that this is a common
experience.
So I wonder, what would it take
On Sat, Jun 7, 2008 at 10:26 AM, Slavomir Kaslev
[EMAIL PROTECTED] wrote:
Hello,
I was just brushing my haskell-fu skills writing a solution for Google
Treasure Hunt Problem 4. Hers is what it looks like:
primes = sieve [2..]
where
sieve (p:xs) = p : sieve [x | x - xs, x `mod` p
Xiao-Yong Jin wrote:
Salute! Excellent!
Patrick Perry [EMAIL PROTECTED] writes:
* Support for both immutable and mutable types. Haskell tries
to make you use immutable types as much as possible, and indeed there
is a very good reason for this, but sometimes you have a 100MB
On Sat, 2008-06-07 at 09:36 -0700, Thomas Hartman wrote:
cabal issue?
Yes and no.
What is happening is that there are several versions of the Cabal
library installed. In particular Cabal-1.3.12 and Cabal-1.5.2. The happy
package uses build-type Custom so cabal-install compiles the Setup.lhs
On Sat, 7 Jun 2008 12:26:17 +0300
Slavomir Kaslev [EMAIL PROTECTED] wrote:
I was just brushing my haskell-fu skills writing a solution for Google
Treasure Hunt Problem 4. Hers is what it looks like:
primes = sieve [2..]
where
sieve (p:xs) = p : sieve [x | x - xs, x `mod` p /=
dominic.steinitz:
I'm getting errors (see below) trying to build the tests in
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mersenne-random-0.1.1
I built the package itself using
./Setup configure -f use_sse2
I thought I had an intel core duo (also see below). I think I
On Jun 7, 11:21 am, Don Stewart [EMAIL PROTECTED] wrote:
The best thing anyone here can do for haskell is contribute a library.
The more areas we cover with Haskell code, the easier the path is to
ongoing development, and a viable, sustainable Haskell world.
Hi Don,
I cannot agree more
Dominic Steinitz wrote:
I'm getting errors (see below) trying to build the tests in
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mersenne-random-0.1.1
[snip]
Linking Unit ...
Unit.o: In function `s4Da_info':
(.text+0x1b21): undefined reference to `genrand_real2'
Unit.o:
Am Samstag, 7. Juni 2008 11:26 schrieb Slavomir Kaslev:
Hello,
I was just brushing my haskell-fu skills writing a solution for Google
Treasure Hunt Problem 4. Hers is what it looks like:
primes = sieve [2..]
where
sieve (p:xs) = p : sieve [x | x - xs, x `mod` p /= 0]
That
Hello All,
I've recently modified my existing project to support dynamic data
(using 'Data.Dynamic'), and despite my earlier benchmarks on 'Dynamic', the
program slowed down by a factor of 10. Profiler says that 'fromDynamic' is
consuming 60% of the CPU time (with -O2).
Using the below
On Sat, 2008-06-07 at 18:44 +0100, Duncan Coutts wrote:
Perhaps a better solution is for cabal-install to choose the version of
the Cabal library differently. Of course it has to be within the hard
constraints specified in the .cabal file and on the command line. But
after that perhaps it
Am Samstag, 7. Juni 2008 17:31 schrieb Loup Vaillant:
2008/6/6 Andrew Coppin [EMAIL PROTECTED]:
Until very recently, it was not at all clear to me that there is actually
a very simple solution to this problem:
import Text.ParserCombinators.Parsec as P
Now I only have to write
Hello Loup,
Saturday, June 7, 2008, 7:31:29 PM, you wrote:
Is there any difference between:
import Very.Long.Module.Name as M
and:
import qualified Very.Long.Module.Name as M
with first you get *both* qualified and unqualified identifiers, with
second - only qualified
--
Best regards,
2008/6/7 Dmitri O.Kondratiev [EMAIL PROTECTED]:
class Store s where
put :: Eq k = (k, v) - s - s
get :: k s - Maybe v
I suspect you want this to be a constructor class. That is, you want
to make explicit the fact that the type s depends on k and v.
class Store s where
put :: Eq
On Sat, Jun 7, 2008 at 1:08 PM, Luke Palmer [EMAIL PROTECTED] wrote:
2008/6/7 Dmitri O.Kondratiev [EMAIL PROTECTED]:
class Store s where
put :: Eq k = (k, v) - s - s
get :: k s - Maybe v
I suspect you want this to be a constructor class. That is, you want
to make explicit the fact
Duncan Coutts wrote:
The immediate workarounds are:
* unregister Cabal-1.5.2
Better, hide it (that's reversible) - or does that not work with
cabal-install?
Bertram
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Sat, 2008-06-07 at 21:20 +0200, Bertram Felgenhauer wrote:
Duncan Coutts wrote:
The immediate workarounds are:
* unregister Cabal-1.5.2
Better, hide it (that's reversible) - or does that not work with
cabal-install?
If Cabal ignored hidden packages then you could never install
2008/6/6 Galchin, Vasili [EMAIL PROTECTED]:
I want to do an incremental experiment. I want just want to pass a C
function to callback to a Haskell function. ???
This is easy; just declare the function via the FFI; here's an example
from my implementation for the 2006 ICFP contest
The second prime generator on this page
http://www.haskell.org/haskellwiki/Prime_numbers
is quick and easy. I keep it nearby for all those sudden attacks of
needing to solve yet another projecteuler problem.
-ljr
Slavomir Kaslev wrote:
Hello,
I was just brushing my haskell-fu skills
great, sudo cabal install from inside 1.17 distribution dir now seems
to do the right thing.
however, after it's done installing (apparently without error) the
happy version is still 1.16 and the happy executable is from 2006.
This means that I still can't install other packages that rely on
On Sat, 2008-06-07 at 14:46 -0700, Thomas Hartman wrote:
great, sudo cabal install from inside 1.17 distribution dir now seems
to do the right thing.
however, after it's done installing (apparently without error) the
happy version is still 1.16 and the happy executable is from 2006.
This
Hi, probably I am just being dumb, but what is the most
efficient way to do a sum of every elements in a Vector of
either hmatrix or blas? I know there is sum of absolute
values from BLAS. So what about I want a plain sum?
I can only think of the following two ways.
1. Using Data.List.foldl',
{--
Thanks!
Yes, you got it right - I want to make explicit the fact that the type s
depends on k and v.
So I followed your advice and used the most simple way to do what I need:
--}
class Store s where
put :: Eq k = (k, v) - s k v - s k v
get :: Eq k = k - s k v - Maybe v
instance Store
Version 0.0.3 was release, which is nearly a complete (and completely
trivial) xenctrl.h binding. Aside from unit tests and programs, the
main things missing are grant table operations. There is now a quick
and dirty home page at the wiki [1] and a darcs repo on c.h.o [2].
Comments, requests,
47 matches
Mail list logo