Gregory Propf wrote:
Thanks, that was helpful. I didn't realize that there were pure
functional monads.
Actually, it's stronger than that. All monads are pure functional, even
IO. Haskell is an entirely 100% pure functional language[*]. The IO
monad allows you to build up, in a pure,
Paul Hudak wrote:
readFile :: Name - FailCont - StrCont - Behaviour
Here StrCont was the success continuation, which took a string (the file
contents) as argument. I rather liked the flexibility that this offered
-- since I/O errors were fairly common, it made sense to give success
and
contrary to monadic parsers, those continuation-based parsers
had *two* continuations, one for success, one for failure. and
that seemed to be a very natural match for the problem.
Two-continuations is a monad too, right?
yes, but my problem is not about giving them a monadic interface,
but
On Fri, 2007-06-29 at 19:35 +0200, Thomas Schilling wrote:
On 27 jun 2007, at 18.41, Hans van Thiel wrote:
[snip]
Thanks, Apfelmus, for the references. Guess I'll start there, then.
And
thanks, Chris, for the info and code. Read only 'up pointers' could be
what is needed. But
On Mon, Jul 02, 2007 at 12:23:36AM +0200, Hugh Perkins wrote:
Clll :-) Thanks for the link.
Er are you the Philip Armstrong I was at college with
Shhh. Don't tell everyone or they'll all want one. (iow, yes: Probably.)
Phil
--
http://www.kantaka.co.uk/ .oOo. public key:
class Monad m = MonadError e m | m - e where
throwError :: e - m a
catchError :: m a - (e - m a) - m a
..
power of TwoCont? I mean, it still seems like there's an operation
missing that supplies new left and right continuations at once.
i guess, instead of one DiMonad with two sets of
apfelmus wrote:
class DiMonad m where
returnR :: a - m e a
bindR :: m e a - (a - m e b) - m e b
returnL :: e - m e a
bindL :: m e a - (e - m e' a) - m e' a
type TwoCont e a = (e - R) - (a - R) - R
A final question remains: does the dimonad abstraction cover the
poop wrote:
So I'm working my way thorough haskell, doing some programming problems,
and I have this one so far:
Hi, I haven't spotted the problem in your code but there's an alternative
solution to Euler Problem 14 on the wiki:
What were monads like before they became a Haskell language construct?
Is Haskell's idea of a monad actually anywhere close to the original
mathematical formalism?
Just being randomly curiose...
___
Haskell-Cafe mailing list
lol small world :-)
On 7/2/07, Philip Armstrong [EMAIL PROTECTED] wrote:
On Mon, Jul 02, 2007 at 12:23:36AM +0200, Hugh Perkins wrote:
Clll :-) Thanks for the link.
Er are you the Philip Armstrong I was at college with
Shhh. Don't tell everyone or they'll all want one.
On 7/2/07, Andrew Coppin [EMAIL PROTECTED] wrote:
What were monads like before they became a Haskell language construct?
Is Haskell's idea of a monad actually anywhere close to the original
mathematical formalism?
It's as close to a mathematician's notion of a monad as Haskell's
types and
Dan Piponi wrote:
On 7/2/07, Andrew Coppin [EMAIL PROTECTED] wrote:
What were monads like before they became a Haskell language construct?
Is Haskell's idea of a monad actually anywhere close to the original
mathematical formalism?
It's as close to a mathematician's notion of a monad as
Right, I read more about it and found this out. The 'main' function is
apparently magical at runtime and allows you to break the with pure
functionality just once but since it can call other functions this allows for
useful programs to be written.
- Original Message
From: Jules Bean
As a programming exercise I'm trying to use the State monad to create a simple
parser. It's for a very simple assembly language for a simple virtual machine.
The state is a string of instructions. I want to be able to call something
like getNextInstruction to pull out the next instruction
Gregory Propf wrote:
Right, I read more about it and found this out. The 'main' function is
apparently magical at runtime and allows you to break the with pure
functionality just once but since it can call other functions this allows
for useful programs to be written.
There is more than one
Gregory Propf wrote:
As a programming exercise I'm trying to use the State monad to create a
simple parser. It's for a very simple assembly language for a simple
virtual machine. The state is a string of instructions. I want to be
able to call something like getNextInstruction to pull out
On Monday 02 July 2007, Andrew Coppin wrote:
What were monads like before they became a Haskell language construct?
Is Haskell's idea of a monad actually anywhere close to the original
mathematical formalism?
Just being randomly curiose...
Curiosity can be a dangerous thing . . .
Short
vim: set ft=lhaskell:
On Mon, Jul 02, 2007 at 02:25:57PM -0700, Gregory Propf wrote:
| As a programming exercise I'm trying to use the State monad to create
| a simple parser. It's for a very simple assembly language for a
| simple virtual machine. The state is a string of instructions. I
|
In imperative languages we can do this type of thing:
SystemLogging.LogInfo(About to do something...);
DoSomething();
SystemLogging.LogInfo(Did Something);
SystemLogging.LogInfo(x is + x );
How can we do something similar in Haskell?
___
Haskell-Cafe
This sounds something like using a continuation function.
In imperative languages, we might have something like:
class MyDisplayForm
{
void ButtonGo_Press()
{
Processor.Go( new CallbackDelegate( this.SetStatus ) );
}
public void SetStatus( string message )
{
StatusLbl.Text
On Tue, Jul 03, 2007 at 12:26:47AM +0200, Hugh Perkins wrote:
This sounds something like using a continuation function.
In imperative languages, we might have something like:
class MyDisplayForm
{
void ButtonGo_Press()
{
Processor.Go( new CallbackDelegate( this.SetStatus ) );
I hadn't seen that before, thanks. My code wouldn't be that useful as it
depends on some of my datatypes. I don't know some basic things here since I'm
so new to Haskell. For example, am I to assume that I need to create my own
instance of State and then define get and put for it? Some of
Hi
SystemLogging.LogInfo(Did Something);
SystemLogging.LogInfo(x is + x );
How can we do something similar in Haskell?
See trace: http://www.haskell.org/hoogle/?q=trace
Thanks
Neil
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Hugh Perkins [EMAIL PROTECTED] writes:
SystemLogging.LogInfo(About to do something...);
DoSomething();
SystemLogging.LogInfo(Did Something);
SystemLogging.LogInfo(x is + x );
How can we do something similar in Haskell?
Maybe, with System.IO,
main =
do log - openFile /tmp/log.txt
Graham Hutton has some great tutorials on parsing. Check out the Are
parsers monodic? thread (not exact name) for a good reference.
There's also a good tutorial at http://www.cs.nott.ac.uk/~gmh/book.html In
Section Slides, click on 8 Functional parsers, but you may just want to
start from 1.
On 7/3/07, Neil Mitchell [EMAIL PROTECTED] wrote:
See trace: http://www.haskell.org/hoogle/?q=trace
I'll check that out. Thanks.
Maybe, with System.IO,
Fine in main :-) Less good in a 100,000 line application.
___
Haskell-Cafe mailing list
Hugh Perkins [EMAIL PROTECTED] writes:
(snip)
Maybe, with System.IO,
Fine in main :-) Less good in a 100,000 line application.
Oh, sorry, I thought your point had been about making sure the operation
was done before the did something line got printed. (-:
-- Mark
http://cvs.haskell.org/cgi-bin
/cvsweb.cgi/fptools/libraries/GLUT/examples/RedBook/
Ok, I'll take a look
What makes a callback different from any other kind of function?
Well... what about inside monads? Does this break purity??? Does this
require adding IO to the monad if the callback
On 7/2/07, Hugh Perkins [EMAIL PROTECTED] wrote:
Anyway, so the question is: how do we write callback functions in
FP/Haskell? Can someone provide a simple, but functional example?
What makes a callback different from any other kind of function? In
Haskell, as in other functional programming
On Jul 2, 2007, at 18:40 , Neil Mitchell wrote:
SystemLogging.LogInfo(Did Something);
SystemLogging.LogInfo(x is + x );
How can we do something similar in Haskell?
See trace: http://www.haskell.org/hoogle/?q=trace
In addition, you could use the Writer monad to collect log
information
On 7/2/07, Hugh Perkins [EMAIL PROTECTED] wrote:
Well... what about inside monads? Does this break purity??? Does this
require adding IO to the monad if the callback function does IO?
Check out the documentation for the HOpenGL callbacks here:
Gregory Propf wrote:
| [...] For example, am I to assume that I need to
| create my own instance of State and then define get and put for it?
No, there is a 'State s' monad provided (for arbitrary state type 's'),
which implements the 'get' and 'put' methods. In other words, 'State s' is
an
This was a bit baffling too. It appears that there's an implied argument to
runTick. This also works and makes it more explicit. I suppose the compiler
just works out that the only place to put the 'n' is after tick.
runTick :: Int - (String,Int)
runTick n = runState tick n
- Original
On 7/2/07, Gregory Propf [EMAIL PROTECTED] wrote:
This was a bit baffling too. It appears that there's an implied argument to
runTick. This also works and makes it more explicit. I suppose the compiler
just works out that the only place to put the 'n' is after tick.
runTick :: Int -
Hugh Perkins wrote:
What makes a callback different from any other kind of function?
Well... what about inside monads? Does this break purity??? Does this
require adding IO to the monad if the callback function does IO?
As I'm writing this I kindof have this sense inside me that this is
OK, I get the reference to currying now. A function of 2 variables can be seen
as a function of one that returns another function of one. So a function of
one variable can be seen as a function of no variables that returns a function
of one. Very nice.
- Original Message
From: Tim
36 matches
Mail list logo