Bill Wood [EMAIL PROTECTED] writes:
The variable mem is a so-called hybrid variable; it crunches
together 2 different concepts: a boolean value (could I allocate
memory?) and an address value (what is the address where I can find
my allocated memory).
IMO, Maybe is exactly the oppsite, it
I'm puzzling out how to get a Bool from am IO Bool. I know I'm not
supposed to, but I don't see any way around my predicament.
The basic setup is: I have an edit box, and a panel. If you click the
LMB on the panel when the edit box is checked, this means you want to
move a graphical object
Take a look at unsafePerformIO, it is of type IO a - a. Its not
particularly safe (the name gives a clue), but it does what you
want.
On 9/20/05, Mark Carter [EMAIL PROTECTED] wrote:
I'm puzzling out how to get a Bool from am IO Bool. I know I'm not
supposed to, but I don't see any way around
Mark Carter wrote:
I'm puzzling out how to get a Bool from am IO Bool. I know I'm not
supposed to, but I don't see any way around my predicament.
The basic setup is: I have an edit box, and a panel. If you click the
LMB on the panel when the edit box is checked, this means you want to
move
On Tue, Sep 20, 2005 at 04:30:25PM +0100, Neil Mitchell wrote:
Take a look at unsafePerformIO, it is of type IO a - a. Its not
particularly safe (the name gives a clue), but it does what you
want.
I dont think you would ever need to do unsafePerformIO unless
you are writing some lib
Greg Buchholz wrote:
Have you read...
http://haskell.org/hawiki/ThatAnnoyingIoType
Thanks. I'll take a look at it. I also need to take a look at the basic
Haskell syntax. An interesting-looking web page which discusses monads is:
http://www.nomaware.com/monads/html/analogy.html
Mark Carter wrote:
What struck me was this bit of code:
assemblyLine w = (return w) = makeChopsticks = polishChopsticks
= wrapChopsticks
Interestingly, this looks like Forth (!), where you put a value on the
stack, and successive operations fiddle with the stack as a series of
. . .
What struck me was this bit of code:
assemblyLine w = (return w) = makeChopsticks = polishChopsticks =
wrapChopsticks
Interestingly, this looks like Forth (!), where you put a value on the
stack, and successive operations fiddle with the stack as a series of
. . .
Another thing I noticed in my nano-experience of Haskell is the Maybe
monad. This is interesting because it's a bit like a hybrid variables.
If you look at a book like Writing Solid Code (or is it Code
Complete, I can't remember now) which examine C style, they basically
scorn
Mark Carter wrote:
The typical example in C is:
mem = malloc(1024)
Malloc returns 0 to indicate that memory cannot be allocated, or a
memory address if it can. The variable mem is a so-called hybrid
variable; it crunches together 2 different concepts: a boolean value
(could I allocate
. . .
The typical example in C is:
mem = malloc(1024)
Malloc returns 0 to indicate that memory cannot be allocated, or a
memory address if it can. The variable mem is a so-called hybrid
variable; it crunches together 2 different concepts: a boolean value
(could I allocate memory?) and
Lennart Augustsson wrote:
Mark Carter wrote:
The typical example in C is:
mem = malloc(1024)
Malloc returns 0 to indicate that memory cannot be allocated, or a
memory address if it can. The variable mem is a so-called hybrid
variable; it crunches together 2 different concepts: a boolean
Compare:
int *p=...;
int x=*p;
and:
let
p = ...
Just x = p
So actually, there is few difference between dereferencing a pointer
without checking for 0, and extracting the Maybe value without
handling Nothing, apart from that it leads to undefined behavior in C
which in fact isn't
Mark Carter wrote:
What struck me was this bit of code:
assemblyLine w = (return w) = makeChopsticks = polishChopsticks =
wrapChopsticks
Interestingly, this looks like Forth (!), where you put a value on the
stack, and successive operations fiddle with the stack as a series of
Mark Carter wrote:
Could you briefly elaborate on what you mean by hybrid variables?
According to Google, hybrid in genetics means The offspring of
genetically dissimilar parents or stock, especially the offspring
produced by breeding plants or animals of different varieties, species,
There's a big difference.
You can see you are doing something fishy, and the compiler
can too, and it can warn you.
-- Lennart
Michael Walter wrote:
Compare:
int *p=...;
int x=*p;
and:
let
p = ...
Just x = p
So actually, there is few difference between dereferencing a
16 matches
Mail list logo