On 2012-01-24 05:32, Michael Snoyman wrote:
On Fri, Jan 20, 2012 at 6:52 AM, Michael Snoymanmich...@snoyman.com wrote:
provide an extra warning flag (turned on by -Wall) that will
warn when you match on a failable pattern.
I've filed a feature request for this warning:
On 2012-01-19 23:52, Michael Snoyman wrote:
maybe I should file a feature request: provide an extra warning
flag (turned on by -Wall) that will warn when you match on a failable
pattern.
I fully agree if it's IO, so that a failed pattern match leads to an
exception. The nice implementations
On 2011-12-30 14:32, Steve Horne wrote:
A possible way to implement a Haskell program would be...
1. Apply rewrite rules to evaluate everything possible without
executing primitive IO actions.
2. Wait until you need to run the program.
3. Continue applying rewrite rules to evaluate
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
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.
, evaluation, has a separate
place in the language.
-- Scott Turner
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On 2011-10-02 14:15, Du Xi wrote:
I guess this is what I want, thank you all. Although I still wonder why
something so simple in C++ is actually more verbose and requires less
known features in Haskell...What was the design intent to disallow
simple overloading?
Simple overloading is known as
On 2011-06-25 10:52, David Mazieres wrote:
Further confusing things, GHC accepts the following:
g1 x y z = if xy then show x ++ show z else g2 y x
g2 :: (Show a, Ord a) = a - a - String
g2 | False = \p q - g1 q p ()
| otherwise = \p q - g1 q p 'a'
On 2011-05-02 03:54, Ketil Malde wrote:
There is a particular reason why monads had to arise in Haskell,
though, which is to defeat the scourge of laziness.
I wonder if there are any other rationale for a statement like that?
He spends one paragraph dismissing the usefulness of
On 2011-03-21 01:18, David Barbour wrote:
I was giving Control.Arrow a try for a reactive programming system.
The arrows are agents that communicate by sending and returning
time-varying state. Different agents may live in different 'vats'
(event-driven threads) to roughly model distributed
On 2011-02-11 02:06, wren ng thornton wrote:
And it is clear
that pointed and unpointed versions are different types[1].
...
[1] Though conversion between them is easy. From unpointed to pointed is
just a forgetful functor; from pointed to unpointed is the monad of
evaluation.
I'm unskilled
On 2010-11-17 21:03, Peter Schmitz wrote:
I am wondering how to generalize this to do likewise for a
series of commands, where the varying args (filenames, in this
case) are in a list ('inOutLeafs').
The 'sequence' function is handy for combining a series of actions, such
as [system cmd1,
The essence of mergeIO is to merge the _lists_ that are produced by
independent threads. As far as Haskell is concerned, the elements in the list
are another matter, as is the evaluation of those elements.
So the merge functions force the evaluation of their arguments to a certain
extent.
On Monday 21 December 2009 20:37:30 zaxis wrote:
In erlang, first i use the following function to set the seed:
new_seed() -
{_,_,X} = erlang:now(),
{H,M,S} = time(),
H1 = H * X rem 32767,
M1 = M * X rem 32767,
S1 = S * X rem 32767,
put(random_seed, {H1,M1,S1}).
On 2008 October 16 Thursday, Duncan Coutts wrote:
On Thu, 2008-10-16 at 01:24 +0200, Ariel J. Birnbaum wrote:
Floating point operations, at least by IEEE754, depend on environmental
settings like the current rounding mode. They may modify state, like the
sticky bits that indicate an
On 2008 August 08 Friday, Changying Li wrote:
I want to write a reverse proxy like perlbal to practive haskell. Now I
just write a very simple script to forward any request to
www.google.com.
but it dosn't work. I run command ' runhaskell Proxy.hs' and 'wget
http://localhost:8080/'. but
On 2007 May 13 Sunday 14:52, Benja Fallenstein wrote:
2007/5/12, Derek Elkins [EMAIL PROTECTED]:
In Haskell codata and data coincide, but if you want consistency, that
cannot be the case.
For fun and to see what you have to avoid, here's the proof of Curry's
paradox, using weird infinite
On 2007 January 23 Tuesday 17:33, Yitzchak Gale wrote:
1. Find a way to model strictness/laziness properties of Haskell functions
in a category in a way that is reasonably rich.
2. Map monads in that category to Haskell, and see what we get.
3. Compare that to the traditional concept of a
On 2006 August 21 Monday 04:42, Gene A wrote:
but can you have
a list of type [Num] ?? I thought that it had to be the base types of
Int, Integer, Float, Double etc.. No?
See http://www.haskell.org/hawiki/ExistentialTypes
___
Haskell-Cafe mailing
Aditya Siram wrote:
Prelude sin pi
1.22460635382238e-16 --WRONG!
Neil Mitchell wrote:
Floating point numbers are not exact, the value of pi is not exact
either, and I guess that between them they are giving you errors.
Yes. Actually, this particular inexactness is entirely due to the value
On 2006 March 05 Sunday 05:43, Shannon -jj Behrens wrote:
classifyString s = Token (whichType s) s
where whichType volatile = Qualifier
whichType void = Type
whichType char = Type
whichType signed = Type
whichType unsigned = Type
On 2005 September 15 Thursday 12:09, John Goerzen wrote:
However, the difficulty I come up time and again is: parsec normally
expects to parse as much as possible at once.
With networking, you must be careful not to attempt to read more data
than the server hands back, or else you'll block.
On 2005 July 16 Saturday 11:19, yin wrote:
I need some testing 'main' function:
./bundle01 cmd arg1 arg2 ...
Your code is close to working. Most likely the detail which gave you trouble
is the syntax for mod. It should be
b01_mod a b = a `mod` b
Infix operator names in Haskell all use
On 2005 June 02 Thursday 04:38, Gracjan Polak wrote:
iorefset :: Ord a = IORef(Map.Map a a)
iorefset = unsafePerformIO $ do
newIORef $ Map.empty
I could have as many dictionaries as there are types. The problem is I
get one dictionary for each object which defeats the idea.
To avoid
On 2005 May 17 Tuesday 11:44, Donn Cave wrote:
You can get efficiency, the desired data, and deal with infinite strings.
reversed_inits = scanl (flip (:))
find (isPrefixOf (reverse needle)) (reversed_inits haystack)
With get efficiency, I was comparing this program which is linear
On 2005 May 16 Monday 08:00, Gracjan Polak wrote:
Ketil Malde wrote:
While the result isn't exactly the same, I suspect
using isPrefixOf and tails would be more efficient.
I need the data before and including my needle.
When the haystack gets large, the beautiful
find (isSuffixOf
On 2005 April 18 Monday 16:57, Dmitry Vyal wrote:
Am not sure about the relevance of this approach as i have very little
experience with Haskell and FP. So it would be great if someone offers
better solution.
It's a valid approach. Rather than declare an Updateable class, I'd just have
the
On 2005 January 31 Monday 04:56, Graham Klyne wrote:
How can it make sense to have a BOM in UTF-8? UTF-8 is a sequence of
octets (bytes); what ordering is there here that can sensibly be varied?
Correct. There is no order to be varied.
A BOM came to be permitted because it uses the identical
On 2004 December 29 Wednesday 19:13, Dominic Fox wrote:
any obvious respects in which this program
could be simplified, clarified or made more idiomatic.
isYes = `elem` [y, yes, Y, YES]
withArticle fullString@(x:xs) =
(if x `elem` aeiou then an else a ) ++ fullString
withArticle [] = -- in
On 2004 December 19 Sunday 17:31, armin langhofer wrote:
this is the use:
Prelude :l e:\haskell\burstall.hs
Main fix square 0.01
0.01
it seems that i dont have a clue how it works. maybe some of you could
explain it to me that i can pass the exam tomorrow,
Do you know
On 2004 December 05 Sunday 18:19, Rolf Wilms wrote:
[Newbie warning on] Here's a few random obeservations from my playing with
Haskell:
You've got into Haskell with unusual rapidity. Most of your observations are
fairly aimed.
Recently found a memoization modulue in Hugs, but no docs.
On 2004 December 02 Thursday 09:35, Mark Carroll wrote:
I like Control.Monad.Error but often my stuff is threaded through
the IO monad so, AFAICT from the functional dependency stuff, that means
my errors have to be IOErrors. Is that right? And, then, I want control
over what's actually
On 2004 December 03 Friday 05:33, Frédéric Gobry wrote:
important memory usage problems (in fact, at each attempt, I
Alternatively, if I took the wrong direction, please refocus my search
http://haskell.org/hawiki/ForcingEagerEvaluation and especially follow the
link and look at Strict
On 2004 December 03 Friday 15:16, GoldPython wrote:
until I joined this email list a couple weeks ago, I had never met another
human being that knew what functional programming was
My experience has been different in Massachusetts. At my first job after my
Comp Sci degree, developing
On 2004 November 16 Tuesday 06:42, Jérémy Bobbio wrote:
There is a probleme with ShowS though: it is not internationalizable at
all. Strings like printf's or with any kind of variable substitution is
required for proper internationalization / localization.
Printf is not adequate for
On 2004 November 03 Wednesday 09:51, Alexander Kogan wrote:
merge' a x = (addToFM (+) $! a) x 1
is not strict.
Can I do something to make FiniteMap strict?
Or the only way is to make my own StrictFiniteMap?
You can replace
addToFM_C (+) a x 1
with
let a' = addToFM_C (+) a x 1 in
On 2004 November 01 Monday 16:48, Alexander N. Kogan wrote:
Sorry, I don't understand. I thought the problem is in laziness -
You're correct. The problem is laziness rather than I/O.
my list
of tuples becomes (qqq, 1+1+1+.) etc and my program reads whole file
before it starts processing.
On 2004 October 09 Saturday 15:33, William Lee Irwin III wrote:
So, I discovered that simple continued fractions are supposed to be
spiffy lazy lists and thought I'd bang out some continued fraction code.
But then I discovered ContFrac.hs and couldn't really better it. Of
course, I went about
On 2004 October 08 Friday 09:57, John Goerzen wrote:
defaultHandler :: LogHandler b = IO (a - IORef b)
defaultHandler = do
h - (streamHandler stdout WARNING)
r - newIORef h
return (\x - r)
The idea is to create a new IORef to something in
On 2004 September 19 Sunday 13:40, Andrew Harris wrote:
handleSeeRecord :: [SeeObjInfo_type] - RobotState - IO (RobotState, ())
handleSeeRecord seeobjlist p = do flaglist - return (morphToList
flagFinder seeobjlist)
balllist - return (morphToList
ballFinder
On 2004 September 16 Thursday 06:19, Simon Marlow wrote:
Argv and the environment - I don't know. Windows CreateProcess() allows
these to be UTF-16 strings, but I don't know what encoding/decoding
happens between CreateProcess() and what the target process sees in its
argv[] (can't be
On 2004 July 26 Monday 13:46, [EMAIL PROTECTED] wrote:
According to Enderton, one of the ways to define an ordered pair (a,b)
is {{a},{a,b}}. A relation is defined as a set of ordered-pairs. A
map, of course, is a single-valued relation.
The motivation for defining ordered pairs that way is
On 2004 July 06 Tuesday 05:35, Graham Klyne wrote:
When I'm designing datatypes for a Haskell program, I sometimes seem to end
up with a slightly incoherent mixture of algebraic types and
constructors.
example
data Event = Document DocURI Element
| Element Name BaseURI
On 2004 June 07 Monday 15:19, Ron de Bruijn wrote:
newtype S a = State - (a,State) -- functor T to map
objects
mapS::(a- b) - (S a - S b) -- functor T to map
morphisms
unitS :: a - S a --\eta
joinS::S(S a)- S a -- \mu
This is a complete monad using a direct mapping from
Category Theory.
On Saturday 12 January 2002 17:35, you wrote:
(I'm just a new convertee to the ways of Functional Programming, so
please go easy on me! ^_^;;)
Welcome. Hope you find it as fun and useful as I.
Why is it that `Double's in Hugs only seem to have the same
precision as a `Float'? I've some code
on implementation-dependent optimizations.
BTW, I've wondered why the Prelude provides foldl, which commonly leads to
this trap, and does not provide the strict variant foldl', which is useful
enough that it's defined internal to the Hugs prelude. Simple prejudice
against strictness?
--
Scott Turner
[EMAIL
n the list, it assumes that the list is non-empty,
which is not the case when the end of the list is reached. A runtime error
is inevitable.
--
Scott Turner
[EMAIL PROTECTED] http://www.billygoat.org/pkturner
___
Haskell-Cafe mailing list
[EMAIL
47 matches
Mail list logo