Ronald Guida wrote:
Here is the brief explanation I came up with:
Arrows and monads are abstract data types used to construct Domain
Specific Embedded Languages (DSELs) within Haskel. A simple arrow
provides a closed DSEL. A monad is a special type of arrow that
creates an open
Stefan O'Rear wrote:
apfelmus wrote:
My assumption is that we have an equivalence
forall a,b . m (a - m b) ~ (a - m b)
because any side effect executed by the extra m on the outside can well
be delayed until we are supplied a value a. Well, at least when all
arguments are fully applied,
On 14/08/07, Ronald Guida [EMAIL PROTECTED] wrote:
My present goal is to understand monads well enough to be able to
explain them to others. I wonder if it's possible to create a
tutorial that explains monads well enough so that they just make
sense or click for people.
It seems everyone
Hi
I was trying out some parsing with parsec. I tried:
Accepting proper parenthesized expressions, this was the
code:
parens :: Parser ()
parens = do
char '('
parens
char ')'
parens
| return ()
Implementing basically: S - (S)S | e.
I doubt the fact that 'e' was actually considered,
Vimal wrote:
Hi
I was trying out some parsing with parsec. I tried:
Accepting proper parenthesized expressions, this was the
code:
parens :: Parser ()
parens = do
char '('
parens
char ')'
parens
| return ()
I would indent | return () a bit less:
...
parens
|
Benjamin Franksen wrote:
Brian Brunswick wrote:
One thing that I keep seeing people say (not you), is that
monads /sequence/ side effects. This is wrong, or at
least a limited picture.
/All/ of the above structures are about combining compatible things things
together in a row.
I
I noticed many code snippets on the wiki that have syntax colouring.
How is this done? Can I convert syntax coloured code from Emacs to HTML?
I'm using the Haskell mode for Emacs to get the syntax colouring.
I'm writing a monads for C# programmers tutorial (oh no) and would
M-x htmlize-buffer
On 8/14/07, Peter Verswyvelen [EMAIL PROTECTED] wrote:
I noticed many code snippets on the wiki that have syntax colouring.
How is this done? Can I convert syntax coloured code from Emacs to HTML?
I'm using the Haskell mode for Emacs to get the syntax colouring.
On 8/14/07, Peter Verswyvelen [EMAIL PROTECTED] wrote:
I noticed many code snippets on the wiki that have syntax colouring.
How is this done? Can I convert syntax coloured code from Emacs to HTML?
Look at HsColour:
http://www.cs.york.ac.uk/fp/darcs/hscolour/
regards,
Bas van Dijk
Having just gone through all the tutorials and things (again but
this time I think it stuck) the Haskell community is on the wrong
track as far as teaching Monads to new programmers.
If I were teaching addition and multiplication to children I
wouldn't start with, We'll begin by defining an
I'm looking for cool but mind-bending examples of functional brilliance.
Let us say, hypothetically, you had a bathroom without any reading
material. And having read all the Dilbert and Garfield you could
seriously stomach, decide you should educate yourself while on the
job. :-)
So you decide
On 14/08/07, Lanny Ripple [EMAIL PROTECTED] wrote:
Having just gone through all the tutorials and things (again but
this time I think it stuck) the Haskell community is on the wrong
track as far as teaching Monads to new programmers.
If I were teaching addition and multiplication to children
On 8/14/07, Dougal Stanton [EMAIL PROTECTED] wrote:
I'm looking for cool but mind-bending examples of functional brilliance.
Let us say, hypothetically, you had a bathroom without any reading
material. And having read all the Dilbert and Garfield you could
seriously stomach, decide you should
On Aug 14, 2007, at 11:17 , Dougal Stanton wrote:
Let us say, hypothetically, you had a bathroom without any reading
material. And having read all the Dilbert and Garfield you could
seriously stomach, decide you should educate yourself while on the
job. :-)
Sounds to me like you want a
On Tuesday 14 August 2007 10:17:53 Dougal Stanton wrote:
I'm looking for cool but mind-bending examples of functional brilliance.
Let us say, hypothetically, you had a bathroom without any reading
material. And having read all the Dilbert and Garfield you could
seriously stomach, decide you
Hello,
There is clearly a problem with the Haskell/monad tutorials out there...
The tutorials seriously need to step back and start with
something like, To enforce order of evaluation we evaluate
closures* returning a defined type. The first closure will feed
its result to the second
So you decide to print up some one-liner style programs into a
little booklet. Something between credit-card and postcard sized, with
a neat but mind-bending program on it. Don Stewart occasionally swoops
in with some fixpoint malarkey to defuse heated discussions. I mean
that kind of thing,
Look! You are doing it again! :) Does that paragraph even
contain the word Monad? :)
I'm aware a monad is an abstraction and as such it doesn't *do*
anything. My point was along the lines that you don't need to
know that your working in a field to be able to learn that
3/2 = 1.5
.
Hallo,
On 8/14/07, Jeff Polakow [EMAIL PROTECTED] wrote:
Hello,
There is clearly a problem with the Haskell/monad tutorials out there...
The tutorials seriously need to step back and start with
something like, To enforce order of evaluation we evaluate
closures* returning a defined
On 8/14/07, Jeff Polakow [EMAIL PROTECTED] wrote:
One general intuition about monads is that they represent computations
rather than simple (already computed) values:
x :: Int -- x is an Int
x :: Monad m = m Int -- x is a computation of an Int
What's a computation? It
On 8/14/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
I like the very light weight analogy (which works for most practical
uses of monads) that a monadic action is a recipe
Many introductory programming books present the idea of a program as a
recipe. Here's a recipe for computing factorials:
Hello,
Look! You are doing it again! :) Does that paragraph even
contain the word Monad? :)
Sorry. Your first paragraph led me to believe you were writing about
monads.
I'm aware a monad is an abstraction and as such it doesn't *do*
anything. My point was along the lines that you
Maybe something of these?
http://www.haskell.org/haskellwiki/Blow_your_mind
--
Chad Scherrer
Time flies like an arrow; fruit flies like a banana -- Groucho Marx
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Tue, 2007-08-14 at 09:55 -0500, Lanny Ripple wrote:
Having just gone through all the tutorials and things (again but
this time I think it stuck) the Haskell community is on the wrong
track as far as teaching Monads to new programmers.
If I were teaching addition and multiplication to
On 14/08/07, Dan Piponi [EMAIL PROTECTED] wrote:
On 8/14/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
I like the very light weight analogy (which works for most practical
uses of monads) that a monadic action is a recipe
Many introductory programming books present the idea of a program as
A very good point. I even knew that implicitly but wasn't
thinking in those terms explicitly when writing up my first post
and it does make a difference in how you view things.
-ljr
Jeff Polakow wrote:
Hello,
Look! You are doing it again! :) Does that paragraph even
contain the
You don't normally call x::Int a computation of an Int because there's
nothing that distinguishes the value of the x from what it was before you
computed it. So I prefer to regard x as a value (in a domain, of course).
But for x :: (Monad m) = m Int there is something else happening, so the
word
Derek Elkins wrote:
What people need to do is stop reading two page blog posts by someone
who's just got monads and read the well-written peer-reviewed papers
I have taught many people to program in group settings and
individually in my career. I have referred them to many
tutorials. I
Hello,
On 8/14/07, Jeff Polakow [EMAIL PROTECTED] wrote:
One general intuition about monads is that they represent computations
rather than simple (already computed) values:
x :: Int -- x is an Int
x :: Monad m = m Int -- x is a computation of an Int
What's a
On 14/08/07, Jeff Polakow [EMAIL PROTECTED] wrote:
Of course, the type [Int] denotes a value which is a list of Ints;
additionally [Int] can be viewed as a value representing the
nondeterministic computation of a single Int. Generally, the type Monad m =
m Int can be viewed as a value
On 14/08/07, Brent Yorgey [EMAIL PROTECTED] wrote:
Clearly, we need to actually put together such a book! I'm imagining
something where you have two mostly blank facing pages, with the code by
itself in the middle of the right page; then the next 2-4 pages devoted to a
short discussion of the
On 8/14/07, Lennart Augustsson [EMAIL PROTECTED] wrote:
You don't normally call x::Int a computation of an Int because there's
nothing that distinguishes the value of the x from what it was before you
computed it.
Can you spell out exactly what you mean by this?
So I prefer to regard x as a
On 8/14/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
On 14/08/07, Dan Piponi [EMAIL PROTECTED] wrote:
Where do monads come in?
Well I would try to distinguish between code that we write to compute
values, and values which represent monadic actions when coming up with
analogies.
How would
On 14/08/07, Dan Piponi [EMAIL PROTECTED] wrote:
On 8/14/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
On 14/08/07, Dan Piponi [EMAIL PROTECTED] wrote:
Where do monads come in?
Well I would try to distinguish between code that we write to compute
values, and values which represent
On 8/14/07, Dougal Stanton [EMAIL PROTECTED] wrote:
On 14/08/07, Brent Yorgey [EMAIL PROTECTED] wrote:
Clearly, we need to actually put together such a book! I'm imagining
something where you have two mostly blank facing pages, with the code by
itself in the middle of the right page; then
On 8/14/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
Well that's easy, don't use the recipe analogy to explain code, use it
for monadic values exclusively, and you avoid the confusion entirely!
I don't think it's that complicated.
It certainly is complicated. I think I have a good grasp of
On 2007-08-14, Dan Piponi [EMAIL PROTECTED] wrote:
On 8/14/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
I like the very light weight analogy (which works for most practical
uses of monads) that a monadic action is a recipe
Many introductory programming books present the idea of a program as
Hello,
On 14/08/07, Jeff Polakow [EMAIL PROTECTED] wrote:
Of course, the type [Int] denotes a value which is a list of Ints;
additionally [Int] can be viewed as a value representing the
nondeterministic computation of a single Int. Generally, the type
Monad m = m Int can be viewed as a
On 2007-08-14, Spencer Janssen [EMAIL PROTECTED] wrote:
On Tuesday 14 August 2007 10:17:53 Dougal Stanton wrote:
I'm looking for cool but mind-bending examples of functional brilliance.
Let us say, hypothetically, you had a bathroom without any reading
material. And having read all the
Setup.hs wants a module that Cabal hides. Am I doing something wrong (newbie :-)
or should I try to fall back to Cabal-1.1.6.1?
$ ghc --make -o setup Setup.hs
Setup.hs:13:7:
Could not find module `Distribution.Compat.FilePath':
it is hidden (in package Cabal-1.1.6.2)
On 14/08/07, Dan Piponi [EMAIL PROTECTED] wrote:
On 8/14/07, Sebastian Sylvan [EMAIL PROTECTED] wrote:
Well that's easy, don't use the recipe analogy to explain code, use it
for monadic values exclusively, and you avoid the confusion entirely!
I don't think it's that complicated.
It
Dan Piponi wrote:
| On 8/14/07, Lennart Augustsson [EMAIL PROTECTED] wrote:
| You don't normally call x::Int a computation of an Int because there's
| nothing that distinguishes the value of the x from what it was before
| you computed it.
|
| Can you spell out exactly what you mean by this?
Dan Piponi, Tue, 14 Aug 2007 11:52:16 -0700:
All functions can be viewed as recipes. (+) is a recipe. Give me some
ingredients (two numbers) and I'll use (+) to give you back their sum.
(+) is not a recipe, it is a chef. On the other hand,
(return 5 :: State Integer) is a recipe. You need a
On 14/08/07, Malte Milatz [EMAIL PROTECTED] wrote:
Dan Piponi, Tue, 14 Aug 2007 11:52:16 -0700:
All functions can be viewed as recipes. (+) is a recipe. Give me some
ingredients (two numbers) and I'll use (+) to give you back their sum.
(+) is not a recipe, it is a chef. On the other hand,
Sebastian Sylvan wrote:
On 14/08/07, Dan Piponi [EMAIL PROTECTED] wrote:
If I was one of your students and you said that monads are recipes I
would immediately ask you where the monads are in my factorial program
regardless of whether you had introduced one or two different
analogies for
On 14/08/07, Seth Gordon [EMAIL PROTECTED] wrote:
Sebastian Sylvan wrote:
On 14/08/07, Dan Piponi [EMAIL PROTECTED] wrote:
If I was one of your students and you said that monads are recipes I
would immediately ask you where the monads are in my factorial program
regardless of whether you
Hi,
I am trying to do the exercise which asks to define built-in functions
'last' and 'init' using 'foldr' function, such as last Greggery Peccary =
'y'
the type for my function is:
myLast :: [Char] - Char
I am not generalizing type so that make it less complicated. But what ever
i am
On 2007-08-14, Alexteslin [EMAIL PROTECTED] wrote:
Hi,
I am trying to do the exercise which asks to define built-in functions
'last' and 'init' using 'foldr' function, such as last Greggery Peccary =
'y'
the type for my function is:
myLast :: [Char] - Char
I am not generalizing type
John Dell'Aquila wrote:
Setup.hs wants a module that Cabal hides. Am I doing something wrong
(newbie :-)
or should I try to fall back to Cabal-1.1.6.1?
$ ghc --make -o setup Setup.hs
Setup.hs:13:7:
Could not find module `Distribution.Compat.FilePath':
it is hidden (in package
I've found a way to do it, but it's not pretty.
Hint: The function in the foldr first get the last value, and will
need to keep it the whole way through. How can it tell if it is being
given the last item or an earlier item?
I'm generally not too good at the Socratic method, so feel free to
Well, i have tried cons (:) operator but when it passed to foldr doesn't work
because cons operator operates first character and then the list but the
foldr argument takes a function (a-a-a). Maybe i am missing the point
here?
Aaron Denney wrote:
On 2007-08-14, Alexteslin [EMAIL PROTECTED]
2007/8/14, Alexteslin [EMAIL PROTECTED]:
Well, i have tried cons (:) operator but when it passed to foldr doesn't work
because cons operator operates first character and then the list but the
foldr argument takes a function (a-a-a). Maybe i am missing the point
here?
What Aaron was saying
You can consider foldr to be continual modification of a state. The
initial state is given as an argument, and then the (a - b - b)
function is passed the next element of the list and the current state,
and it returns the new state. foldr will then return the final state,
from which the result can
(Quoting reformatted. Try to have your responses below what you are
responding to. It makes it easier to read as a conversation.)
On 2007-08-14, Alexteslin [EMAIL PROTECTED] wrote:
Aaron Denney wrote:
Folds replace the cons operator (:) with the function you pass it.
If you want the tail of
On 2007-08-14, Chaddaï Fouché [EMAIL PROTECTED] wrote:
2007/8/14, Alexteslin [EMAIL PROTECTED]:
Well, i have tried cons (:) operator but when it passed to foldr doesn't work
because cons operator operates first character and then the list but the
foldr argument takes a function (a-a-a). Maybe
Conor McBride and Ross Paterson said it best in the introduction to
their paper Applicative programming with effects [1]:
This is the story of a pattern that popped up time
and again in our daily work,..., until the temptation
to abstract it became irresistible. Let us illustrate
with
On 14/08/07, Dan Weston [EMAIL PROTECTED] wrote:
[snips another metaphor for monadic programming]
No offence to Dan, whose post I enjoyed. The concept of wrapping is as
close a metaphor as we seem to get without disagreements. But this has
brought me to a realisation, after Paul Erdos:
The
2007/8/14, Aaron Denney [EMAIL PROTECTED]:
The problem with foldl is that you can't easily make it polymorphic
because of how the null case is handled. foldl1 and foldr1 are trivial,
true.
The original last fail on empty list, it's far easier to obtain the
same semantic with foldl than with
snark
As you know, an arrow tutorial is like a wrapper around a monad tutorial, sort of like a container
around it that can do extra actions with sufficient lifting. The appropriate higher-order function
to convert monad tutorials to arrow tutorials will be left as an exercise to the reader.
On 2007-08-14, Chaddaï Fouché [EMAIL PROTECTED] wrote:
2007/8/14, Aaron Denney [EMAIL PROTECTED]:
The problem with foldl is that you can't easily make it polymorphic
because of how the null case is handled. foldl1 and foldr1 are trivial,
true.
The original last fail on empty list, it's far
On 8/14/07, Dan Weston [EMAIL PROTECTED] wrote:
Conor McBride and Ross Paterson said it best in the introduction to
their paper Applicative programming with effects [1]:
As von Neumann said: Young man, in mathematics you don't understand
things, you just get used to them.
Getting used to
On Tue, 2007-08-14 at 12:40 -0500, Lanny Ripple wrote:
Derek Elkins wrote:
What people need to do is stop reading two page blog posts by someone
who's just got monads and read the well-written peer-reviewed papers
I have taught many people to program in group settings and
individually in
On 8/14/07, Michael Vanier [EMAIL PROTECTED] wrote:
I'm becoming more and more convinced that metaphors for monads do more harm
than good. From now on
I'm going to describe monads as purely abstract entities that obey certain
laws, and that _in
certain instances_ can be viewed to be like
For what it's worth, the nature of Haskell is such that you do (at least currently) have to spend a
lot of time reading research papers to understand what's going on. Maybe that will change sometime,
but probably not soon. This ties in to the open-endedness of Haskell; I sometimes think that
Sorry to spam you Jeff, again I sent my email to the poster rather than the
list. I'm using Yahoo beta webmail and don't see a way to set it to reply to
the list rather than the originator. Anyway, this was my post:
Hence the need to perform a run operation like runIdentity, evalState or
On 15/08/07, Gregory Propf [EMAIL PROTECTED] wrote:
- Original Message
From: Jeff Polakow [EMAIL PROTECTED]
One general intuition about monads is that they represent computations
rather than simple (already computed) values:
I still want to re-iterate that they represent /complex/
I have a large Haskell/C project that needs to be linked against an even
larger set of C libraries and object files (OpNet) on a linux box (Fedora
Core 7). So far I have been able to link my Haskell libraries to some C
test code containing a main function without incident. However the link
On Tue, 2007-08-14 at 16:02 -0700, Dan Piponi wrote:
. . .
On 8/14/07, Michael Vanier [EMAIL PROTECTED] wrote:
I'm reminded of
a physics teacher who was having a similar problem explaining the concept
of tensors, until he said
that a tensor is something that transforms like a tensor
That fixed my problem. Thank you very much.
Regards,
John
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
We've refactored the happs repos and are now going to releasing
components of HAppS as individual useful packages. HAppS-Data is the
first one. Don't pull a tag, pull the most recent stuff in the repos.
---
HAppS-Data v0.9: XML, Name/Value Pairs, HList, deriveAll
* toXml and fromXml
Hello Haskellers. I'm one of the Google Summer of Code students for '07
and I'd like to announce the project my mentor, Neil Mitchell, and I
have been working on.
== GuiHaskell
Guihaskell is a graphical REPL using PropLang, a GUI combinator library
built on top of Gtk2hs, which aims to be an
Grrr...must...hold...my...tongue...
Dan, as a former student of a clone of that physics teacher, I am really
interested in what you will say when you fail to hold your tongue.
-- Bill Wood
MV I have to admit I was wondering the same thing myself.
So was I.
72 matches
Mail list logo