Hello Martin,
Monday, February 5, 2007, 2:47:33 AM, you wrote:
main = do
minput - getInput
case minput of
Nothing - printError
Just input - do
mresult - processInput input
case mresult of
Nothing - printError
Just result - printResult
J. Garrett Morris wrote:
This is where my favorite part of the mtl steps in: monad transformers.
I agree, the Error monad is very helpful here.
First, we'll create a transformed version of the IO monad,
Why go to the trouble of creating a new monad?
The existing ones are fine.
(While
On 2/5/07, Bulat Ziganshin [EMAIL PROTECTED] wrote:
Hello J.,
Sunday, February 4, 2007, 11:46:57 PM, you wrote:
exists s wmap = isJust $ find (==s) . snd = Map.lookup (sort s) wmap
exists s wmap = Map.lookup (sort s) wmap
== snd
== find (==s)
haskellers, I'm contemplating returning to school after a decade as a
worker bee, and almost that long as a worker bee doing computer
consulting / miscelaneous tech stuff.
Ideally I'd like to get a masters, but I don't know if that's feasible
this late in the game. If it's not, I might settle
2007/2/5, Thomas Hartman [EMAIL PROTECTED]:
haskellers, I'm contemplating returning to school after a decade as a
worker bee, and almost that long as a worker bee doing computer
consulting / miscelaneous tech stuff.
Ideally I'd like to get a masters, but I don't know if that's feasible
this
Thomas,
Here's a good place to start, although I'm not sure how up to date it is:
http://haskell.org/haskellwiki/Haskell_in_education
I too am interested in an FP-related, higher education in California. Could
you please send another post with whatever information you find?
Thanks,
Greg
On
Andrew Wagner wrote:
I've got several problems which seem to have a very similar structure.
I want to find a way to abstract them to solve other problems which
can be thought about in the same way. Here they are:
http://hpaste.org/307
http://hpaste.org/308
http://hpaste.org/309
Note that these
On 2/5/07, Yitzchak Gale [EMAIL PROTECTED] wrote:
J. Garrett Morris wrote:
First, we'll create a transformed version of the IO monad,
Why go to the trouble of creating a new monad?
The existing ones are fine.
Mainly to keep the type error messages simpler. A project I was
working on started
I wrote:
Why go to the trouble of creating a new monad?
The existing ones are fine.
J. Garrett Morris wrote:
Mainly to keep the type error messages simpler.
There are two ways to get around that problem:
1. Make your functions polymorphic, using
MonadState, MonadError, etc. Each function
Thomas Hartman [EMAIL PROTECTED] wrote:
Whether master's, bachelor's, or other, I am specifically interested
in programs that are functional friendly.
You might find that Utrecht has something of interest, e.g. the Masters
in Software Technology.
On 2/5/07, Martin DeMello [EMAIL PROTECTED] wrote:
On 2/5/07, Matthew Brecknell [EMAIL PROTECTED] wrote:
This is probably what you wanted (untested):
w - readWords words
words - varCreate w
That didn't work, because (as someone on #haskell explained to me)
readWords has type IO and the wx
On 2/5/07, Yitzchak Gale [EMAIL PROTECTED] wrote:
J. Garrett Morris wrote:
Mainly to keep the type error messages simpler.
There are two ways to get around that problem:
1. Make your functions polymorphic, using
MonadState, MonadError, etc. Each function
mentions only the capabilities that it
Martin DeMello wrote:
On 2/5/07, Bulat Ziganshin [EMAIL PROTECTED] wrote:
Hello J.,
Sunday, February 4, 2007, 11:46:57 PM, you wrote:
exists s wmap = isJust $ find (==s) . snd = Map.lookup (sort s) wmap
exists s wmap = Map.lookup (sort s) wmap
== snd
==
Andrew Wagner wrote:
Hi everyone,
I've got an interesting problem here I'm trying to solve. Actually,
I've got several problems which seem to have a very similar structure.
I want to find a way to abstract them to solve other problems which
can be thought about in the same way. Here they are:
Help,
How to calculate the sum of list of lists in Haskell?
Please help me,
Miranda
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hi Miranda,
How to calculate the sum of list of lists in Haskell?
What do you mean by this? What is the value of a list?
If you mean sum the numbers such that [[1,2],[3,4]] = 1+2+3+4 then you
are able to ask two alternative questions - how do i convert a list of
lists to a list, and how do i
If I understand you correctly, this should do it:
sums :: Num a = [[a]] - a
sums l = sum [sum p | p - l]
-Eric
On 2/5/07, Miranda Kajtazi [EMAIL PROTECTED] wrote:
Help,
How to calculate the sum of list of lists in Haskell?
Please help me,
Miranda
Miranda Kajtazi wrote:
Help,
How to calculate the sum of list of lists in Haskell?
Do you mean something of the form Num a = [[a]] - a ?
If so, this should do it:
Prelude let foo = sum . concat
Prelude foo [[1,2,3],[4,5]]
15
Cheers,
Maxime
___
Thomas Hartman wrote:
haskellers, I'm contemplating returning to school after a decade as a
worker bee, and almost that long as a worker bee doing computer
consulting / miscelaneous tech stuff.
Ideally I'd like to get a masters, but I don't know if that's feasible
this late in the game. If it's
Miranda Kajtazi [EMAIL PROTECTED] writes:
Help,
How to calculate the sum of list of lists in Haskell?
So the answer for [[1,2],[3,4]] would be 10?
(Is this homework? If so, we're still happy to give hints.)
-- Mark
___
Haskell-Cafe mailing list
Hi,
Thanx to all for the previous hints how to solve and write the function to
calculate the sum of a list of lists.
Now I need to know how to remove all numbers that are divisable by an
integer.
Lets say I have a list [2,4,5,6,8] and when I divide them with number 2, my
list should look like
Hi Miranda,
Now I need to know how to remove all numbers that are divisable by an
integer.
Is this a homework problem? Is there some bigger goal you are trying to achieve?
I tried to use some zipWith...filter and other predefined functions..but I
can't really find the right solution :(
Hi,
How am I supposed to use infinite lists to define the list of all negative
integers?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Bahtijar == Bahtijar Vogel [EMAIL PROTECTED] writes:
Bahtijar Hi, How am I supposed to use infinite lists to define
Bahtijar the list of all negative integers?
negs = [-1,-2..]
--
WBR,
Max Vasin.
___
Haskell-Cafe mailing list
Hi Bahtijar!
I'm not going to answer your question directly, but let me give you
some background that will hopefully help you discover the pretty
solution yourself.
Consider this definition:
ones = 1 : ones -- This list is essentially [1,1,1,...]
And this expression:
take 5 ones
Now,
Hi all,
I'm trying to create a function which filters out all number from a list
that are divisible by an integer.
Ex. the list [2,3,4,5,6] div 2...should give me the list like: [3,5], other
numbers should be removed divisible by 2.
filter :: (a - Bool) - [a] - [a]
filter p [] = []
filter p
I'd like to hear what tips and techniques you guys have for avoiding space
leaks. I understand the basic techniques to force evaluation of closures.
What I'd like to know is how you avoid space leaks in large, long-lived,
mutable data structures. These kind of data are particularly sensitive
Hi Miranda,
filter :: (a - Bool) - [a] - [a]
filter p [] = []
filter p (x:xs) = if p 'mod' x
then x : filter p xs
else filter p xs
I tried this, but it doesn't work
You are mixing a few things together. First point, mod should be `mod`
and not
On 05/02/07, TJ [EMAIL PROTECTED] wrote:
I went through the entry on laziness on the wikipedia wikibook. Very
nice. The wikibook sure has grown a lot since I last visited.
http://en.wikibooks.org/wiki/Haskell/Laziness
Great! I was about to suggest this! This is one of our
On 05/02/07, Bahtijar Vogel [EMAIL PROTECTED] wrote:
Hi,
How am I supposed to use infinite lists to define the list of all negative
integers?
Don't forget the iterate function:
http://haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html#v%3Aiterate
Also, I may be off the mark here,
FYI we teach and do a fair amount of functional programming here at Caltech. We
have courses using scheme, ocaml, and haskell with more on the way.
Mike
Greg Fitzgerald wrote:
Thomas,
Here's a good place to start, although I'm not sure how up to date it is:
On Fri, Feb 02, 2007 at 01:54:13PM +, Martin Percossi wrote:
Hello, is there a haskell library that provides facilities to read and
use the tzfile format [1], or equivalent in Windows?
Not as far as I am aware.
Thanks
Ian
___
Haskell-Cafe
On 2/5/07, Paul Johnson [EMAIL PROTECTED] wrote:
If you are already a hacker then the right kinds of people to start a
company with may not be the ones you find in a Masters or Bachelor
comp-sci course. Different people have different views on this, of course.
Yeah, actually, I have to agree
On 2/4/07, Eric Olander [EMAIL PROTECTED] wrote:
Hi,
I'm still somewhat new to Haskell, so I'm wondering if there are better
ways I could implement the following functions, especially shiftl:
moves the last element to the head of the list
shiftl :: [a] - [a]
shiftl [] = []
Udo Stenzel wrote:
Sure, you're right, everything flowing in the same direction is usually
nicer, and in central Europe, that order is from the left to the right.
What a shame that the Haskell gods chose to give the arguments to (.)
and ($) the wrong order!
But then application is in the
Yeah, have a look on the shootout:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=recursivelang=all
Has an ackerman.
More detailed comparisions, across the 19 benchmarks on the shootout,
with notes on which of the 19 GHC Haskell is significantly slower (4x) at:
Haskell verus
Hi,
The following code works:
type ServiceMainClosure = DWORD - IO ()
foreign import ccall wrapper
mkServiceMainClosure :: ServiceMainClosure - IO (FunPtr
ServiceMainClosure)
But the following doesn't:
type ServiceMainClosure = DWORD - [String] - IO ()
foreign import ccall wrapper
On Tue, Feb 06, 2007 at 12:33:58PM +1100, John Ky wrote:
Hi,
The following code works:
type ServiceMainClosure = DWORD - IO ()
foreign import ccall wrapper
mkServiceMainClosure :: ServiceMainClosure - IO (FunPtr
ServiceMainClosure)
But the following doesn't:
type
Hi Stefan,
In that case, how do I marshall [String] to Ptr (Ptr CChar)?
Thanks
-John
On 2/6/07, Stefan O'Rear [EMAIL PROTECTED] wrote:
You have to use a type that C's tiny brain understains. IANAWP
but I'm guessing you want:
type ServiceMainClosure = DWORD - Ptr (Ptr CChar) - IO ()
On Tue, Feb 06, 2007 at 12:40:38PM +1100, John Ky wrote:
Hi Stefan,
In that case, how do I marshall [String] to Ptr (Ptr CChar)?
look at Foreign.C.String and Foreign.Ptr
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Actually, what I need to do is a fair bit more complex than string
marshalling. It feels like I'll need to pull together a number of different
concepts so I may as well describe the problem directly.
The C function I want to call is StartServiceCtrlDispatcher:
*BOOL*
I have a structure:
data Attr = Attr { fg :: !Color,
bg :: !Color,
bold :: !Bool,
blink :: !Bool,
rv :: !Bool,
halfBright :: !Bool,
underline :: !Bool
}
G'day all.
Quoting Matthew Brecknell [EMAIL PROTECTED]:
Although it covers irrefutable (lazy) pattern matching in the second
section, it does appear to miss the point that let bindings are always
irrefutable.
Thus, there is no difference between these two:
let (x,y) = foo in ...
let
That's a clever routine. It should be faster than mine since it only makes
a single pass though the list. Thanks for all the suggestions from everyone
that responded. Here is a link to some more info on the project I'm working
on if anyone is interested: http://ehaskell.blogspot.com/
-Eric
I said:
Although it covers irrefutable (lazy) pattern matching in the second
section, it does appear to miss the point that let bindings are always
irrefutable.
Thus, there is no difference between these two:
let (x,y) = foo in ...
let ~(x,y) = foo in ...
Andrew Bromage said:
let (x,())
G'day all.
Quoting Matthew Brecknell [EMAIL PROTECTED]:
In other words, the irrefutability of a pattern match does not
distribute inside the top-level data constructor of the pattern.
I wasn't disagreeing with you, which is why I didn't comment.
Note also that if Haskell prime incorporates
Benjamin Franksen wrote:
Udo Stenzel wrote:
Sure, you're right, everything flowing in the same direction is usually
nicer, and in central Europe, that order is from the left to the right.
What a shame that the Haskell gods chose to give the arguments to (.)
and ($) the wrong order!
But
47 matches
Mail list logo