On Thu, Dec 29, 2011 at 3:45 AM, Antoine Latter aslat...@gmail.com wrote:
On Wed, Dec 28, 2011 at 3:52 PM, Michael Snoyman mich...@snoyman.com wrote:
Hi all,
I just received a bug report from a client that, when an input file is
open in FrameMaker, my program gives a permission denied error.
Steve Horne wrote:
Heinrich Apfelmus wrote:
Purity has nothing to do with the question of whether you can express
IO in Haskell or not.
The beauty of the IO monad is that it doesn't change anything about
purity. Applying the function
bar :: Int - IO Int
to the value 2 will
Sorry, a long and pseudo-philosophical treatise. Trash it before reading.
Heinrich Apfelmus:
You could say that side effects have been moved from functions to some
other type (namely IO) in Haskell.
I have no reason to be categorical, but I believe that calling the
interaction of a Haskell
On 29/12/2011 08:48, Heinrich Apfelmus wrote:
Steve Horne wrote:
Heinrich Apfelmus wrote:
Purity has nothing to do with the question of whether you can
express IO in Haskell or not.
The beauty of the IO monad is that it doesn't change anything about
purity. Applying the function
On Dec 29, 2011, at 9:16 AM, Donn Cave wrote:
Quoth Gregg Reynolds d...@mobileink.com,
On Wed, Dec 28, 2011 at 2:44 PM, Heinrich Apfelmus
apfel...@quantentunnel.de wrote:
The beauty of the IO monad is that it doesn't change anything about purity.
Applying the function
bar :: Int - IO
On 29/12/2011 18:04, Donn Cave wrote:
Quoth Steve Hornesh006d3...@blueyonder.co.uk,
...
Anyway, if you're using IO actions, your code is not referentially
transparent and is therefore impure - by your own definition of
impure. Causing side-effects may not be pedantically the issue, but
the mix
On 29/12/2011 18:41, Chris Smith wrote:
Entering tutorial mode here...
On Thu, 2011-12-29 at 10:04 -0800, Donn Cave wrote:
We can talk endlessly about what your external/execution results
might be for some IO action, but at the formulaic level of a Haskell
program it's a simple function value,
Gregg Reynolds wrote:
Donn Cave wrote:
Quoth Gregg Reynolds wrote:
Look again at the sentence you trimmed off the end:
Of course, the point is that this result is an *IO action* of
type IO Int, it's not the Int you would get when executing
this action.
I believe that more or less points
Quoth Steve Horne sh006d3...@blueyonder.co.uk,
On 29/12/2011 08:48, Heinrich Apfelmus wrote:
...
Well, it's a matter of terminology: impure /= has side effects.
The ability of a language to describe side effects is not tied to its
(im)purity.
Again, purity refers to the semantics of
Quoth Gregg Reynolds d...@mobileink.com,
On Wed, Dec 28, 2011 at 2:44 PM, Heinrich Apfelmus
apfel...@quantentunnel.de wrote:
The beauty of the IO monad is that it doesn't change anything about purity.
Applying the function
bar :: Int - IO Int
to the value 2 will always give the same
Quoth Antoine Latter aslat...@gmail.com,
...
Would this program then loop:
append fromFilePath toFilePath = do
str - readFile fromFile
writeFile toFile str
if 'from' and 'to' where the same file?
Currently the locking prevents this.
Do you mean, locking makes that work, or just makes
Steve Horne wrote:
Heinrich Apfelmus wrote:
Again, purity refers to the semantics of functions (at run-time):
given the same argument, will a function always return the same
result? The answer to this question solely decides whether the
language is pure or impure. Note that this depends on
On Thu, Dec 29, 2011 at 11:49:11AM +, Andrew Coppin wrote:
On 29/12/2011 04:29 AM, Antoine Latter wrote:
On Wed, Dec 28, 2011 at 3:52 PM, Michael Snoymanmich...@snoyman.com wrote:
Hi all,
I just received a bug report from a client that, when an input file is
open in FrameMaker, my
On Wed, Dec 28, 2011 at 2:44 PM, Heinrich Apfelmus
apfel...@quantentunnel.de wrote:
The beauty of the IO monad is that it doesn't change anything about purity.
Applying the function
bar :: Int - IO Int
to the value 2 will always give the same result:
bar 2 = bar (1+1) = bar (5-3)
Quoth Steve Horne sh006d3...@blueyonder.co.uk,
On 29/12/2011 18:41, Chris Smith wrote:
...
On Thu, 2011-12-29 at 10:04 -0800, Donn Cave wrote:
We can talk endlessly about what your external/execution results
might be for some IO action, but at the formulaic level of a Haskell
program it's a
On Thu, Dec 29, 2011 at 11:49 AM, Donn Cave d...@avvanta.com wrote:
Quoth Antoine Latter aslat...@gmail.com,
...
http://www.haskell.org/pipermail/libraries/2011-October/016978.html
... wherein Ian Lynagh proposed to remove this feature and let the
programmer enforce locking or not, as in
On 11-12-26 10:55 AM, Eugene Kirpichov wrote:
How do I most efficiently convert a Double to a Data.Fixed?
Double is an instance of Real, Fixed E12 is an instance of Fractional,
they are eligible for realToFrac.
Similarly for many time types.
___
On Dec 29, 2011, at 11:29 AM, Antoine Latter wrote:
On Thu, Dec 29, 2011 at 11:14 AM, Gregg Reynolds d...@mobileink.com wrote:
On Dec 29, 2011, at 11:01 AM, Iustin Pop wrote:
And to clarify better my original email: yes, (bar x) always gives you
back the same IO action;
More
Every time I hear oh, I don't think Windows can
handle that, I sigh with resignation.
Sorry to say, but it seems you yourself are unaware of the extensive
and highly flexible locking facilities on Linux :) The defaults on
Linux are advisory locking, not mandatory, but claiming Linux doesn't
29.12.2011, 23:55, Gregg Reynolds d...@mobileink.com:
Haskell does not and cannot know what the result of an IO action is, because
it's outside the scope of the language (and computation). (The Int part of
IO Int refers to the input, not the output; it's just a sort of type
On Thu, Dec 29, 2011 at 11:14 AM, Gregg Reynolds d...@mobileink.com wrote:
On Dec 29, 2011, at 11:01 AM, Iustin Pop wrote:
And to clarify better my original email: yes, (bar x) always gives you
back the same IO action;
More precisely: the same *type*.
I'm confused - what do you mean by
Quoth Antoine Latter aslat...@gmail.com,
...
http://www.haskell.org/pipermail/libraries/2011-October/016978.html
... wherein Ian Lynagh proposed to remove this feature and let the
programmer enforce locking or not, as in other programming languages'
base I/O libraries. This met with
On Thu, Dec 29, 2011 at 12:28 PM, Donn Cave d...@avvanta.com wrote:
Quoth Antoine Latter aslat...@gmail.com,
...
Would this program then loop:
append fromFilePath toFilePath = do
str - readFile fromFile
writeFile toFile str
if 'from' and 'to' where the same file?
Currently the
Here's an alternative perspective to consider: consider some
data structure, such as a queue. There are two ways you can
implement this, one the imperative way, with mutators, and the
other the purely functional way, with no destructive updates.
The question then, I ask, is how easy does a
On Thu, Dec 29, 2011 at 12:20:18PM +, Andrew Coppin wrote:
Every time I hear oh, I don't think Windows can
handle that, I sigh with resignation.
Sorry to say, but it seems you yourself are unaware of the extensive
and highly flexible locking facilities on Linux :) The defaults on
Linux
Le 29/12/2011 18:01, Iustin Pop a écrit :
I'm confused as what you mean.
And to clarify better my original email: yes, (bar x) always gives you
back the same IO action; but the results of said IO action are/can be
different when executed.
The whole of my point is that it DOESN'T MATTER. (And I
On Thu, Dec 29, 2011 at 05:51:57PM +0100, Jerzy Karczmarczuk wrote:
Iustin Pop::
In practice too:
bar _ = do
s- readFile /tmp/x.txt
return (read s)
Once you're in a monad that has 'state', the return value doesn't
strictly depend anymore on the function arguments.
Nice example.
I
gather that Linux does now support real locking though. (And file
update notifications, and ACLs, and lots of other things that
Windows has had for far longer.)
Hrmm: Mandatory File Locking For The Linux Operating System, 15 April
1996 :)
Have a reference for when it was actually
On 29/12/2011 19:21, Heinrich Apfelmus wrote:
Why would IO Int be something special or mysterious? It's an
ordinary value like everything else; it's on the same footing as
[Char], Maybe Int, Int - String, Bool, and so on. I see no difference
between the list [1,2,3] :: [Int] and the
On Thu, Dec 29, 2011 at 10:53 AM, Donn Cave d...@avvanta.com wrote:
Quoth Andrew Coppin andrewcop...@btinternet.com,
On 29/12/2011 04:29 AM, Antoine Latter wrote:
...
This bug and its discussion is similar, but not identical:
http://hackage.haskell.org/trac/ghc/ticket/4363
This one has been
Quoth Andrew Coppin andrewcop...@btinternet.com,
On 29/12/2011 04:29 AM, Antoine Latter wrote:
...
This bug and its discussion is similar, but not identical:
http://hackage.haskell.org/trac/ghc/ticket/4363
This one has been rumbling on for ages. As others have said, the Report
demands that
Of course we take in matter what computation getStr :: IO [Char] means.
Of course we take in matter what computation putStr :: String - IO () means
(I know, putStr is not computation, puStr x is computation, but it's not
important)
And If I want to write echo program, I have to combine these
Quoth Gregg Reynolds d...@mobileink.com,
..
A minor point maybe, but germane to the original post (I hope).
It isn't - I mean, I'm not really sure what your point is, but
the example really returns the same IO value, not just one of
the same type.
Consider an example with implementation:
On 29/12/2011 04:29 AM, Antoine Latter wrote:
On Wed, Dec 28, 2011 at 3:52 PM, Michael Snoymanmich...@snoyman.com wrote:
Hi all,
I just received a bug report from a client that, when an input file is
open in FrameMaker, my program gives a permission denied error. This
bug is reproducible with
On Thu, Dec 29, 2011 at 05:55:24PM +0100, Iustin Pop wrote:
On Thu, Dec 29, 2011 at 05:51:57PM +0100, Jerzy Karczmarczuk wrote:
Iustin Pop::
In practice too:
bar _ = do
s- readFile /tmp/x.txt
return (read s)
Once you're in a monad that has 'state', the return value
On Dec 29, 2011, at 11:01 AM, Iustin Pop wrote:
On Thu, Dec 29, 2011 at 05:55:24PM +0100, Iustin Pop wrote:
On Thu, Dec 29, 2011 at 05:51:57PM +0100, Jerzy Karczmarczuk wrote:
Iustin Pop::
In practice too:
bar _ = do
s- readFile /tmp/x.txt
return (read s)
Once you're in a monad
Le Thu, 29 Dec 2011 01:03:34 +,
Steve Horne sh006d3...@blueyonder.co.uk a écrit :
Sorry for the delay. I've written a couple of long replies already,
and both times when I'd finished deleting all the stupid stuff there
was nothing left - it seems I'm so focussed on my own view, I'm
Entering tutorial mode here...
On Thu, 2011-12-29 at 10:04 -0800, Donn Cave wrote:
We can talk endlessly about what your external/execution results
might be for some IO action, but at the formulaic level of a Haskell
program it's a simple function value, e.g., IO Int.
Not to nitpick, but I'm
On 29/12/2011 10:05, Jerzy Karczmarczuk wrote:
Sorry, a long and pseudo-philosophical treatise. Trash it before reading.
Heinrich Apfelmus:
You could say that side effects have been moved from functions to
some other type (namely IO) in Haskell.
I have no reason to be categorical, but I
Iustin Pop::
In practice too:
bar _ = do
s- readFile /tmp/x.txt
return (read s)
Once you're in a monad that has 'state', the return value doesn't
strictly depend anymore on the function arguments.
Nice example. PLEASE, show us the trace of its execution. Then, the
discussion might be
On Thu, Dec 29, 2011 at 07:19:17AM -0600, Gregg Reynolds wrote:
On Wed, Dec 28, 2011 at 2:44 PM, Heinrich Apfelmus
apfel...@quantentunnel.de wrote:
The beauty of the IO monad is that it doesn't change anything about purity.
Applying the function
bar :: Int - IO Int
to the value 2
Hi,
I'm writing a project and was wondering what other people think about it.
This project is meant to be a compiler feature/wrapper that analyzes your
code and chooses the best data structure depending on your source code. It
analyzes the functions used on a wildcard data structure and
If seed depends of psudo random event, for example of current systime,
we must use IO action.
30.12.2011, 02:47, Steve Horne sh006d3...@blueyonder.co.uk:
BTW - why use an IO action for random number generation? There's a
perfectly good pure generator. It's probably handy to treat it
On 12/29/2011 08:47 PM, Steve Horne wrote:
On 29/12/2011 19:21, Heinrich Apfelmus wrote:
BTW - why use an IO action for random number generation? There's a
perfectly good pure generator. It's probably handy to treat it
monadically to sequence the generator state/seed/whatever but random
On Dec 29, 2011, at 12:33 PM, Donn Cave wrote:
Quoth Gregg Reynolds d...@mobileink.com,
..
A minor point maybe, but germane to the original post (I hope).
It isn't - I mean, I'm not really sure what your point is, but
the example really returns the same IO value, not just one of
the same
On 29/12/2011 19:26, Heinrich Apfelmus wrote:
Steve Horne wrote:
Heinrich Apfelmus wrote:
Again, purity refers to the semantics of functions (at run-time):
given the same argument, will a function always return the same
result? The answer to this question solely decides whether the
On Dec 29, 2011, at 1:21 PM, Heinrich Apfelmus wrote:
Why would IO Int be something special or mysterious?
I don't know if it is special or mysterious, but I'm pretty sure IO is
non-deterministic, non-computable, etc. In other words not the same as
computation.
It's an ordinary value
On 29/12/2011 19:55, Bardur Arantsson wrote:
On 12/29/2011 08:47 PM, Steve Horne wrote:
On 29/12/2011 19:21, Heinrich Apfelmus wrote:
BTW - why use an IO action for random number generation? There's a
perfectly good pure generator. It's probably handy to treat it
monadically to sequence the
The story begins here:
Steve Horne:
/BTW - why use an IO action for random number generation? There's a
perfectly good pure generator. It's probably handy to treat it
monadically to sequence the generator state/seed/whatever but random
number generation can be completely pure. /
On Thu, 2011-12-29 at 18:07 +, Steve Horne wrote:
By definition, an intentional effect is a side-effect. To me, it's by
deceptive redefinition - and a lot of arguments rely on mixing
definitions - but nonetheless the jargon meaning is correct within
programming and has been for decades.
On 29/12/2011 20:39, Jerzy Karczmarczuk wrote:
Still, I dont understand what does S.H. mean by a perfectly good
pure generator.
Tell more please (unless you just mean a stream, say:
Probably bad wording, to be honest. I only meant that there's random
number handling support in the Haskell
On Thu, 2011-12-29 at 21:04 +, Steve Horne wrote:
AFAIK there's no hidden unsafePerformIO sneaking any entropy in behind
the scenes. Even if there was, it might be a legitimate reason for
unsafePerformIO - random numbers are in principle non-deterministic,
not determined by the current
Steve Horne :
I only meant that there's random number handling support in the
Haskell library and, and least judging by type signatures, it's pure
functional code with no hint of the IO monad.
Look well at those functions, please.
Within the RandomGen class you have pure members, such as next
On 29/12/2011 21:01, Chris Smith wrote:
On Thu, 2011-12-29 at 18:07 +, Steve Horne wrote:
By definition, an intentional effect is a side-effect. To me, it's by
deceptive redefinition - and a lot of arguments rely on mixing
definitions - but nonetheless the jargon meaning is correct within
On 29/12/2011 21:51, Jerzy Karczmarczuk wrote:
Steve Horne :
I only meant that there's random number handling support in the
Haskell library and, and least judging by type signatures, it's pure
functional code with no hint of the IO monad.
Look well at those functions, please.
Challenge
On 2011-12-29 15:23, Gregg Reynolds wrote:
On Dec 29, 2011, at 1:21 PM, Heinrich Apfelmus wrote:
Why would IO Int be something special or mysterious?
I'm pretty sure IO is non-deterministic, non-computable, etc. In other words
not the same as computation.
It's an ordinary value like
Hi folks,
I'm using Text.Regex.Base with the TDFA and PCRE backends. I want to
compile regular expressions first and make sure the patterns were
actually valid, so I used makeRegexOptsM, which indicates a bad regular
expression by calling fail. That allows you to use makeRegexOptsM with
Maybe or
Sorry to cut most of this out, but I'm trying to focus on the central
point here.
On Thu, 2011-12-29 at 22:01 +, Steve Horne wrote:
In pure functional terms, the result should be equivalent to a fully
evaluated value - but putStrLn isn't pure. It cannot be fully
evaluated until run-time.
Steve Horne wrote:
I haven't seen this view explicitly articulated anywhere before
See Conal Elliott's blog post The C language is purely
functionalhttp://conal.net/blog/posts/the-c-language-is-purely-functional
.
___
Haskell-Cafe mailing list
Steve Horne :
Some code (intended to be loaded into GHCi and played with)
-- import System.Random
-- randSelect this is a list 5 (mkStdGen 9877087)
-- ...
module P23 (randSelect) where
-- ...
randSelect' (x:xs) n l g = let xsLen = (l - 1)
On Thursday 29 December 2011, 23:52:46, Omari Norman wrote:
Hi folks,
I'm using Text.Regex.Base with the TDFA and PCRE backends. I want to
compile regular expressions first and make sure the patterns were
actually valid, so I used makeRegexOptsM, which indicates a bad regular
expression by
On 30/12/2011 00:16, Sebastien Zany wrote:
Steve Horne wrote:
I haven't seen this view explicitly articulated anywhere before
See Conal Elliott's blog post The C language is purely functional
http://conal.net/blog/posts/the-c-language-is-purely-functional.
Thanks - yes, that's basically
On 29/12/2011 23:30, Chris Smith wrote:
Sorry to cut most of this out, but I'm trying to focus on the central
point here.
On Thu, 2011-12-29 at 22:01 +, Steve Horne wrote:
In pure functional terms, the result should be equivalent to a fully
evaluated value - but putStrLn isn't pure. It
Le 30/12/2011 01:44, Steve Horne a écrit :
Switching mental models doesn't change the logic any more than
switching number bases.
Especially when your mental model operates with Dybbuks which do
horrible things behind your back... If this is your vision of logic, it
is a peculiar one.
Either
I wrote that post to point out the fuzziness that fuels many discussion
threads like this one. See also
http://conal.net/blog/posts/notions-of-purity-in-haskell/ and the comments.
I almost never find value in discussion about whether language X is
functional, pure, or even referentially
On 30/12/2011 00:22, Jerzy Karczmarczuk wrote:
Steve Horne :
Some code (intended to be loaded into GHCi and played with)
-- import System.Random
-- randSelect this is a list 5 (mkStdGen 9877087)
-- ...
module P23 (randSelect) where
-- ...
randSelect' (x:xs) n l g =
On Fri, 2011-12-30 at 00:44 +, Steve Horne wrote:
So, to resurrect an example from earlier...
f :: Int - IO Int
f = getAnIntFromTheUser = \i - return (i+1)
Did you mean f :: IO Int ? If not, then I perhaps don't understand
your example, and your monad is not IO. I'll continue assuming
On 2011-12-29 19:44, Steve Horne wrote:
[Interaction with its environment] is as much an aspect of what
Haskell defines as the functional core.
Switching mental models doesn't change the logic
But it does. Other languages do not support the distinction between pure
functions and I/O effects.
I've been for functions like GetMessage, TranslateMessage and
DispatchMessage in the Haskell Platform Win32 library - the usual
message loop stuff - and not finding them. Hoogle says no results found.
Is this level of Win32 GUI coding supported? (other than by dealing with
the FFI myself)
On 30/12/2011 01:37, Chris Smith wrote:
On Fri, 2011-12-30 at 00:44 +, Steve Horne wrote:
So, to resurrect an example from earlier...
f :: Int - IO Int
f = getAnIntFromTheUser= \i - return (i+1)
Did you mean f :: IO Int ? If not, then I perhaps don't understand
your example, and your
What would it take to get an -XOverloadedQuotes flag of the same
sort as the -XOverloadedStrings flag? I.e. [| ... |] would have
type Quasi m = m Exp instead of Q Exp and any splices in that
quotation expect the contents of that splice to have type m Exp.
(Obviously, top level splices would still
(I forgot to announce v0.1 so this is a combined announcement.)
I'm proud to announce the ekg [1] library. The library lets you remotely
monitor any running Haskell program, using your web browser or an automated
monitoring program.
The library lets you monitor garbage collector and memory usage
On 30/12/2011 01:40, Scott Turner wrote:
On 2011-12-29 19:44, Steve Horne wrote:
[Interaction with its environment] is as much an aspect of what
Haskell defines as the functional core.
Switching mental models doesn't change the logic
But it does. Other languages do not support the distinction
On Fri, 2011-12-30 at 02:40 +, Steve Horne wrote:
Well, we're playing a semantic game anyway. Treating effects as
first-class concepts in themselves is fine, but IMO doesn't make
Haskell pure.
Okay, so if you agree that:
(a) IO actions are perfectly good values in the Haskell sense.
(b)
On Fri, Dec 30, 2011 at 2:53 PM, Steve Horne
sh006d3...@blueyonder.co.uk wrote:
I've been for functions like GetMessage, TranslateMessage and
DispatchMessage in the Haskell Platform Win32 library - the usual message
loop stuff - and not finding them. Hoogle says no results found.
Is this
Is there any particular reason IO functions in the standard libraries
aren't grouped into type-classes?
This might allow for:
1) Testing IO code without actual input and output. (I have done this on a
small scale, but it presently involves much ugliness).
2) Redirecting output of a function that
On Fri, Dec 30, 2011 at 4:47 PM, David Thomas davidleotho...@gmail.com wrote:
Is there any particular reason IO functions in the standard libraries aren't
grouped into type-classes?
I'm guessing it's to stop the report from getting too complicated. If
you want an IO abstraction, you can try
On Fri, 2011-12-30 at 01:53 +, Steve Horne wrote:
I've been for functions like GetMessage, TranslateMessage and
DispatchMessage in the Haskell Platform Win32 library - the usual
message loop stuff - and not finding them. Hoogle says no results found.
I see them in the Win32 package.
On 30/12/2011 03:43, Chris Wong wrote:
On Fri, Dec 30, 2011 at 2:53 PM, Steve Horne
sh006d3...@blueyonder.co.uk wrote:
I've been for functions like GetMessage, TranslateMessage and
DispatchMessage in the Haskell Platform Win32 library - the usual message
loop stuff - and not finding them.
On Fri, Dec 30, 2011 at 01:24:02AM +0100, Daniel Fischer wrote:
For Either, there used to be
instance Error e = Monad (Either e) where
...
fail s = Left (strMsg s)
in mtl's Control.Monad.error, and all was fine if one used the regex
functions with e.g. (Either String) as the
On Fri, Dec 30, 2011 at 1:24 PM, Daniel Fischer
daniel.is.fisc...@googlemail.com wrote:
On Thursday 29 December 2011, 23:52:46, Omari Norman wrote:
[...]
'fail' doesn't properly belong in the Monad class, it was added for the
purpose of dealing with pattern-match failures, but most monads
On 30/12/2011 04:07, Chris Smith wrote:
On Fri, 2011-12-30 at 01:53 +, Steve Horne wrote:
I've been for functions like GetMessage, TranslateMessage and
DispatchMessage in the Haskell Platform Win32 library - the usual
message loop stuff - and not finding them. Hoogle says no results found.
Hi,
Steve Horne sh006d3592 at blueyonder.co.uk writes:
I've been for functions like GetMessage, TranslateMessage and
DispatchMessage in the Haskell Platform Win32 library - the usual
message loop stuff - and not finding them. Hoogle says no results found.
Haskell Platform includes the
Hi,
recently I tried the Typing Haskell in Haskell library. But I was
wondering why this program type checks:
-- plusMfun is standard '+': Num a = a - a - a
test = let Just classEnv = ( addCoreClasses : addNumClasses )
initialEnv
e = Ap ( Ap (Var +) (Lit $ LitStr 3)) (Lit $ LitStr
84 matches
Mail list logo