Hi,
I improved the implementation of concatMap:
concatMap' :: (Word8 - L.ByteString) - L.ByteString - L.ByteString
concatMap' f s = L.unfoldr p x0
where x0 = (LI.Empty, s)
p (sf, s) = case L.uncons sf of
Just (c,sf') - Just (c, (sf',s))
Nothing - case
Hi, I will be a TA on a comparative PL course and I'm looking for
small examples (ammunition) which motivate the use of Haskell and
functional programming generally. The course is for 1st year Software
Engineers, none of whom are likely to have used a functional
language. They will all have
Hi,
I'm trying, without success, to understand the difference
between existencial quantification and polymorphic
datatypes. Can you give me a hint, or an example where
one is valid and the other is not?
Thanks,
Maurício
___
Haskell-Cafe mailing list
On Thu, 2009-01-15 at 18:38 -0500, Stephen Hicks wrote:
Hi,
I'm having some difficulty specifying dependencies in my .cabal file
for a package I'm looking to upload to hackage soon. The difficulty
is as follows. I basically want to specify
parsec (= 2.1 3.0.0) || ( 3.0.0 4)
When we
Same here:
Vista, GHC 6.8.3
Tested a bit changed scenario: instead of 20 separate compilations it is
worthwhile to run single, longer build, e.g. ghc --make of same package.
Seems like GHCi does not run garbage collection when machine is busy. And then
it accumulates memory. This renders Vista
Mauricio briqueabra...@yahoo.com writes:
I'm trying, without success, to understand the difference
between existencial quantification and polymorphic
datatypes.
Polymorphic types are universally quantified;
so id:: forall t. t - t
means that id works for every type t. If haskell had a
Do you mean difference between
data A a = A a
and
data B = B a -- leaving out the forall
?
On Tue, Jan 20, 2009 at 10:02 AM, Mauricio briqueabra...@yahoo.com wrote:
Hi,
I'm trying, without success, to understand the difference
between existencial quantification and polymorphic
There was a thread about that:
http://www.haskell.org/pipermail/haskell-cafe/2007-September/
031402.html
Am 20.01.2009 um 11:07 schrieb Jim Burton:
Hi, I will be a TA on a comparative PL course and I'm looking for
small examples (ammunition) which motivate the use of Haskell and
functional
On Wed, Jan 14, 2009 at 3:59 PM, Manlio Perillo
manlio_peri...@libero.it wrote:
2) In Python it is possible to import modules inside a function.
In Haskell something like:
joinPath' root name =
joinPath [root, name]
importing System.FilePath (joinPath)
I just like to point
Mauricio wrote:
Hi,
I'm trying, without success, to understand the difference
between existencial quantification and polymorphic
datatypes. Can you give me a hint, or an example where
one is valid and the other is not?
The first thing to ensure you know is that Haskell can have functions
Adrian Neumann wrote:
There was a thread about that:
http://www.haskell.org/pipermail/haskell-cafe/2007-September/
031402.html
Thanks! I didn't literally mean elevator pitch and if I knew that thread
existed would have phrased my post differently, because a list of the
things that are cool
At my former employer, I wrote a couple of internal tools in
Haskell that shipped to Linux, OS X and Windows. The relative
ease of binary preparation was a selling point of Haskell.
--
Jason Dusek
___
Haskell-Cafe mailing list
Yes, the Agda modules remind me of Cayenne. :)
On Tue, Jan 20, 2009 at 12:54 PM, Bas van Dijk v.dijk@gmail.com wrote:
On Wed, Jan 14, 2009 at 3:59 PM, Manlio Perillo
manlio_peri...@libero.it wrote:
2) In Python it is possible to import modules inside a function.
In Haskell something
david48 wrote:
On the other hand, on page 320 there is a nice explanation of Monoid,
and on page 380, which isn't mentionned in the index, there might be
the first time one can understand why the writer monad works with
monoids instead of lists: to be able to use better suited data types
for
A very nice writeup about the use of monoid with finger tree.
But please, use the names of the monoid operations that the rest of
the Haskell libraries use.
By using different names you are just confusing readers (even if you
don't like the standard names).
Also, you can replace Infinity by
On Tue, Jan 20, 2009 at 3:42 PM, Heinrich Apfelmus
apfel...@quantentunnel.de wrote:
Let me explain this monoid magic, albeit not in this message which would
become far too long, but at
http://apfelmus.nfshost.com/monoid-fingertree.html
That is a very nice summary! I did my own
Jim Burton wrote:
Adrian Neumann wrote:
There was a thread about that:
http://www.haskell.org/pipermail/haskell-cafe/2007-September/
031402.html
Thanks! I didn't literally mean elevator pitch and if I knew that thread
existed would have phrased my post differently, because a list
Lennart Augustsson wrote:
A very nice writeup about the use of monoid with finger tree.
Thanks :)
But please, use the names of the monoid operations that the rest of
the Haskell libraries use.
By using different names you are just confusing readers (even if you
don't like the standard
Hi folks
I have been known to venture the viewpoint that the
newtype trick might benefit from improved library
support, for example, here
http://www.mail-archive.com/haskell-cafe@haskell.org/msg37213.html
This is in a similar vein to Derek's approach, if
accompanied by a little more
4294967296 :: Integer
(...)
In the above you can see the polymorphism of the return type of
fromInteger, it returns a Int8 or a Int32.
You can see the polymorphism of the argument of show, it takes an Int8
or Int32 or Integer.
The latest ghc-6.10.1 also allows avoiding use of SomeNum, see
Mauricio wrote:
But how is this:
data SomeNum = forall a. SN a
different from:
data SomeNum = SN (forall a. a)
In the first case the constructor SN can be applied to the monomorphic
value of any type, it effectively hides the type of the argument. For
example, you can have a list like
I just thought that the shorter explanation could do better: the
difference is in the types of the constructor functions.
Code:
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE RankNTypes #-}
data SomeNum1 = forall a. SN1 a
data SomeNum2 = SN2 (forall a. a)
ghci session:
*Main :t
* John Goerzen jgoer...@complete.org [2009-01-15 10:15:36 -0600]:
If you're learning Haskell, which communicates the idea more clearly:
* Appendable
or
* Monoid
I can immediately figure out what the first one means.
I think that's deceptively misleading. Sure, list1 `mappend`
* Andrew Coppin andrewcop...@btinternet.com [2009-01-16 22:20:35 +]:
A problem I see a lot of [and other people have mentioned this] is that
a lot of documentation presents highly abstracted things, and gives *no
hint* of why on earth these might possibly be useful for something.
I
Great, thanks! I'm enlightened :)
And no one had to hit you with a stick first!
But how is this:
data SomeNum = forall a. SN a
different from:
data SomeNum = SN (forall a. a)
?
At a glance they look the same to me — but only the first is accepted by ghc.
There is also the GADT syntax:
Ross Paterson wrote:
On Mon, Jan 19, 2009 at 01:13:37PM -0800, Jonathan Cast wrote:
(On the other hand, your hunch that lift = return is correct --- so you
get a cookie for that; it's just that return here is neither the return
of the monad for m nor the return of the monad for ReaderT m.
Hello,
I don't mean to be negative here but I really fail to see how do any
of these ideas help the situation. (I do think it would be cool to
have a generic way to lift functions from one type to another that is
isomorphic to it). The fundamental problem is that there are multiple
functions of
Tom Hawkins wrote:
Such a database would help me counter by boss's
argument that it's impossible to find and hire Haskell programmers.
There was a thread last week where someone asked who would be interested
in a hypothetical Haskell job. He got about 20 positive responses.
This agrees
But how is this:
data SomeNum = forall a. SN a
different from:
data SomeNum = SN (forall a. a)
At a glance they look the same to me — but only the first is accepted by
ghc.
Following the link you pointed in the last
message, I found this at 8.8.4.1:
data T a = T1 (forall b. b - b - b) a
If
On Tue, Jan 20, 2009 at 1:50 PM, Paul Johnson p...@cogito.org.uk wrote:
Tom Hawkins wrote:
Such a database would help me counter by boss's
argument that it's impossible to find and hire Haskell programmers.
There was a thread last week where someone asked who would be interested in
a
On Tue, Jan 20, 2009 at 2:51 PM, Mauricio briqueabra...@yahoo.com wrote:
But how is this:
data SomeNum = forall a. SN a
different from:
data SomeNum = SN (forall a. a)
At a glance they look the same to me — but only the first is accepted by
ghc.
Following the link you pointed in the last
One of the coolest things about Haskell is the ability to refer to
values not yet calculated, without having to work out the timing yourself.
You want Fibonacci numbers?
Prelude let z = zipWith (+) (0:1:z) (0:z) in take 10 z
[0,1,1,2,3,5,8,13,21,34]
Try doing that in one line of C++.
See
At Tue, 20 Jan 2009 12:25:00 -0800,
Dan Weston wrote:
Hi Dan,
One of the coolest things about Haskell is the ability to refer to
values not yet calculated, without having to work out the timing yourself.
You want Fibonacci numbers?
Well, I might but they definitely do not :-) We are
On Tue, Jan 20, 2009 at 1:14 PM, David Menendez d...@zednenem.com wrote:
On Tue, Jan 20, 2009 at 2:51 PM, Mauricio briqueabra...@yahoo.com wrote:
But how is this:
data SomeNum = forall a. SN a
different from:
data SomeNum = SN (forall a. a)
At a glance they look the same to me — but
Jim Burton schrieb:
Well, I might but they definitely do not :-) We are talking about some
maths-averse people and you would not have got to the final syllable
of 'fibonacci' before all hope was lost. But I am sure there are
plenty of examples that rely on laziness which will communicate. I
I recommend checking out Don Syme's slides from CUFP 2008.
http://cufp.galois.com/2008/slides/
This isn't Haskell directly, it's F#, but it fits the functional
programming generally, and the two languages have, relative to the
universe of programming languages, more in common than they do
Hi all,
When I try this bit of code:
class C1 a where
type F a :: *
x :: F a
y :: F a
x = y
I get this error:
Couldn't match expected type `F a1' against inferred type `F a'
In the expression: y
In the definition of `x': x = y
I can't figure out what is going on or
On Thu, 15 Jan 2009, John Goerzen wrote:
One thing that does annoy me about Haskell- naming. Say you've
noticed a common pattern, a lot of data structures are similar to
the difference list I described above, in that they have an empty
state and the ability to append things onto the end.
John Goerzen schrieb:
Though if all we're talking about is naming, I would still maintain that
newbie-friendly naming is a win. We can always say HEY MATHEMETICIANS:
APPENDABLE MEANS MONOID in the haddock docs ;-)
We already have a problem with this:
Haskell 98 uses intuitive names for the
On Tue, 2009-01-20 at 23:41 +0100, Henning Thielemann wrote:
On Thu, 15 Jan 2009, John Goerzen wrote:
One thing that does annoy me about Haskell- naming. Say you've
noticed a common pattern, a lot of data structures are similar to
the difference list I described above, in that they
Apfelmus, Heinrich schrieb:
Obviously, those who know what a monoid is have already invested years
of time practicing mathematics while those that even attack the name
monoid clearly lack this practice. It's like peano virtuosoes compared
to beginning keyboard pressers.
Aren't all Haskellers
rocon...@theorem.ca schrieb:
On Sun, 18 Jan 2009, Ross Paterson wrote:
Anyone can check out the darcs repos for the libraries, and post
suggested improvements to the documentation to librar...@haskell.org
(though you have to subscribe). It doesn't even have to be a patch.
Sure, it could
At Tue, 20 Jan 2009 22:08:55 +0100,
Henning Thielemann wrote:
Jim Burton schrieb:
Well, I might but they definitely do not :-) We are talking about some
maths-averse people and you would not have got to the final syllable
of 'fibonacci' before all hope was lost. But I am sure there are
At Tue, 20 Jan 2009 14:17:10 -0800,
Ryan Ingram wrote:
I recommend checking out Don Syme's slides from CUFP 2008.
http://cufp.galois.com/2008/slides/
This isn't Haskell directly, it's F#, but it fits the functional
programming generally, and the two languages have, relative to the
Hi all,
I'm using WinXP with 6.8.3. For some reason the windows version of 6.8.3
ships with a somewhat castrated version of package process, one that
does not contain readProcess among other convenient functions.
Is there a way to install the fully fledged version of process, because
I
Hello,
Is there a pure Haskell implementation of Floats, i.e., one that
(unlike GHC.Float) doesn't use foreign calls for things like
isFloatNegativeZero? I don't care about performance; I'm just looking
for something that doesn't use foreign calls.
Thanks,
Tim
--
Tim Chevalier *
catamorphism:
Hello,
Is there a pure Haskell implementation of Floats, i.e., one that
(unlike GHC.Float) doesn't use foreign calls for things like
isFloatNegativeZero? I don't care about performance; I'm just looking
for something that doesn't use foreign calls.
Huh, what's the use case?
On 1/20/09, Don Stewart d...@galois.com wrote:
catamorphism:
Hello,
Is there a pure Haskell implementation of Floats, i.e., one that
(unlike GHC.Float) doesn't use foreign calls for things like
isFloatNegativeZero? I don't care about performance; I'm just looking
for something that
http://apfelmus.nfshost.com/monoid-fingertree.html
Thanks Apfelmus for this inspiring contribution!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Do you have Integer?
On Wed, Jan 21, 2009 at 12:23 AM, Tim Chevalier catamorph...@gmail.com wrote:
On 1/20/09, Don Stewart d...@galois.com wrote:
catamorphism:
Hello,
Is there a pure Haskell implementation of Floats, i.e., one that
(unlike GHC.Float) doesn't use foreign calls for
On 1/20/09, Lennart Augustsson lenn...@augustsson.net wrote:
Do you have Integer?
Yes (with the integer-simple library -- I was hoping there was some
analogue of integer-simple for Float, although Don didn't think there
was one).
-t
--
Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error,
There's the numbers package which contains BigFloat. You can pick
your own precision, but it's not IEEE.
It's actually base 10 floats which makes it more fun (actually, the
iEEE standard will cover base 10 floats in the future).
-- Lennart
On Wed, Jan 21, 2009 at 12:44 AM, Tim Chevalier
Lovely reformulation, Ryan!
I think lub [4] is sufficient typeclass hackery for unambPatterns:
unambPatterns == lubs == foldr lub undefined
[4] http://conal.net/blog/posts/merging-partial-values
I think performance is okay now, if you have very recent versions of unamb
*and* GHC head
Luke Palmer wrote:
On Mon, Jan 19, 2009 at 3:58 AM, Patai Gergely patai_gerg...@fastmail.fmwrote:
However, there are other type classes that are too general to assign
such concrete uses to. For instance, if a data structure can have more
than one meaningful (and useful) Functor or Monoid
Patai Gergely wrote:
Hi everyone,
I have a general program design question, but I can't really think of
good examples so it will be a bit vague. There was a discussion on Show
not long ago which brought up the problem that there are several ways to
show a data structure, and it depends on the
On Wed, 2009-01-14 at 15:59 +0100, Manlio Perillo wrote:
1) In a Python string it is available the \U{name} escape, where name is
a character name in the Unicode database.
As an example:
foo = uabc\N{VULGAR FRACTION ONE HALF}
This is possible via QuasiQuotation, you can
Monads are monoids in categories of functors C - C
Arrows are monoids in subcategories of bifunctors (C^op) x C - C
Trees are a playing ground for functors in general:-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Jim Burton wrote:
Hi, I will be a TA on a comparative PL course and I'm looking for
small examples (ammunition) which motivate the use of Haskell and
functional programming generally. The course is for 1st year Software
Engineers, none of whom are likely to have used a functional
language. They
Strange little bit of code:
http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=829#a829
If I do any of the following, all of which seem natural to me, it fails to
typecheck:
1. move f out of the 'where' clause (with or without a type signature)
2. put the same type signature on f as is
Andrew Wagner wrote:
Strange little bit of code:
http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=829#a829
If I do any of the following, all of which seem natural to me, it fails to
typecheck:
1. move f out of the 'where' clause (with or without a type signature)
2. put the same
So...there's just no good way to avoid the duplication?
On Tue, Jan 20, 2009 at 11:10 PM, wren ng thornton w...@freegeek.orgwrote:
Andrew Wagner wrote:
Strange little bit of code:
http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=829#a829
If I do any of the following, all of which seem
Instead of declaring (/\) :: Eq a = Sentence a - Sentence a -
Sentence a, you could say (/\) :: Eq a - [a] - [a] - [a]. Then it
would work in both places. ([a] - [a] - [a] is a more general type
than [[Term a]] - [[Term a]] - [[Term a]], so functions with the
former type can be used in place of
On Jan 20, 2009, at 7:35 PM, wren ng thornton wrote:
Jim Burton wrote:
Hi, I will be a TA on a comparative PL course and I'm looking for
small examples (ammunition) which motivate the use of Haskell and
functional programming generally. The course is for 1st year Software
Engineers, none of
On 1/17/2009 08:21, Tim Newsham wrote:
There's however still no framework which supports both HTTP client and
server functions using the same Request and Response data type, right? I
don't know whether I am the only one who needs this (e.g. for the Real
Monad Transformer). E.g. a proxy would
Hi,
a new release of HTTP, version 4000.0.4, is now available
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HTTP
It is also pointed at via the updated HTTP web page --
http://projects.haskell.org/http/
The main change is the addition of registering a Browser event handler
for
2009/1/21 Don Stewart d...@galois.com:
http://apfelmus.nfshost.com/monoid-fingertree.html
Thanks Apfelmus for this inspiring contribution!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
66 matches
Mail list logo