Re: [Haskell-cafe] haskell gsoc proposal for richer numerical type classes and supporting algorithms

2010-04-10 Thread Paul McJones

Dear Carter,

Although I'm not an active Haskell programmer, I'd like to add my 
support for you to write up your GSOC application.


In the first five chapters of the book /Elements of Programming/ 
(Addison-Wesley, 2009), my coauthor Alex Stepanov and I undertook a 
somewhat similar effort, only using C++ instead of Haskell. We started 
with semigroups and monoids, and ended with rings and modules and a 
careful treatment of GCD.


C++ does not have a direct analog of the Haskell type class, so we 
developed our own informal conventions for documenting the definitions 
of concepts and the corresponding type requirements in function 
templates and class templates.  The concept definitions extracted from 
the book are available here:


http://www.elementsofprogramming.com/eop-concepts.pdf

and the source code here:

http://www.elementsofprogramming.com/code.html

I subsequently translated the concepts and functions from the first 
(functional) half of our book into Haskell. It was a useful learning 
exercise for me (giving me an appreciation for Edward Kmett's comments 
on your proposal), and has led to fruitful discussions with Henning 
Thielemann (see the Haskell Numerical Prelude and 
http://www.haskell.org/haskellwiki/Mathematical_prelude_discussion) and 
Jacques Carette (MathScheme, etc.).



Paul McJones


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple game: a monad for each player

2010-04-10 Thread Yves Parès

Okay for IA, which doesn't need any special monad, but what if I want to make
a network player ?
It would have to run in a State monad, accessing to IO, storing a
ByteString.
For instance, (Monad m) => StateT ByteString m.
The ByteString is a lazy one, we read from it to get the data sent by the
real player through the network.

Then, if I want to have a human an a network player playing sequentially,
how can I do this without stacking each player's monad? (See my first mail)


Philippa Cowderoy wrote:
> 
> On 10/04/2010 13:57, Yves Parès wrote:
>> I answered my own question by reading this monad-prompt example:
>> http://paste.lisp.org/display/53766
>>
>> But one issue remains: those examples show how to make play EITHER a
>> human
>> or an AI. I don't see how to make a human player and an AI play
>> SEQUENTIALLY
>> (to a TicTacToe, for instance).
>>
>>
> 
> Make them polymorphic - the human player in any MonadIO, the AI player 
> in any monad. Then run them both in the same monad, with some kind of 
> wrapping function around the calls setting a context for the appropriate 
> player.
> 
> -- 
> fli...@flippac.org
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 


-
Yves Parès

Live long and prosper
-- 
View this message in context: 
http://old.nabble.com/Simple-game%3A-a-monad-for-each-player-tp28183930p28204685.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Difficulties installing LLVM bindings

2010-04-10 Thread Aran Donohue
UNIVERSAL=1 worked for me too. Is there a way for cabal install to detect if
LLVM wasn't built with this required flag and give a more informative error
message?

Aran

On Sat, Apr 10, 2010 at 2:28 AM, Max Bolingbroke  wrote:

> On 10 April 2010 03:18, Aran Donohue  wrote:
> > problems with ghc-pkg.  I think we need to rebuild LLVM forcing 32-mode,
> but
> > I haven't yet found the results of this. I'd love to hear what you did if
> > you manage to get it going and compile programs.
>
> My LLVM checkout was still recompiling when I sent that email, but
> it's now finished and it fixed the problem.
>
> All you need to do is compile LLVM as follows:
>
> $ UNIVERSAL=1 make
>
> Then "make install" the result. That made the LLVM bindings configure
> and compile fine for me.
>
> Cheers,
> Max
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-10 Thread Iavor Diatchki
Hello,
I wonder if it might be possible to use just one primitive which atomically
changes the interrupt mask for a thread?  Here is an example of what I'm
thinking:

data MaskingState   = Unmasked
   | MaskedInterruptible
   | MaskedNonInterruptible

-- Atomically changes the interrupt mask for a thread, and returns the old
mask.
setMask:: MaskingState -> IO MaskingState
setMask = error "primitive?"

-- Change the mask for the duration of an IO action.
-- The action is passed the old mask.
scopedSetMask  :: MaskingState -> (MaskingState -> IO a) -> IO a
scopedSetMask m io  = do m1 <- setMask m
a  <- io m1
setMask m1
return a

-- Change the mask for the duration of an IO action.
scopedSetMask_ :: MaskingState -> IO a -> IO a
scopedSetMask_ m io = scopedSetMask m $ \_ ->
   io
-- Simon's mask:
mask   :: ((IO a -> IO a) -> IO b) -> IO b
mask f  = scopedSetMask MaskedInterruptible $ \m ->
   f (scopedSetMask_ m)


-Iavor


On Sat, Apr 10, 2010 at 11:42 AM, Iavor Diatchki 
wrote:
> Hello,
> It seems that rank-2 types are sufficient to make the more polymorphic
types:
>
> 
> {-# LANGUAGE Rank2Types #-}
> import Control.Exception
>
> data Mask = Mask (forall a. IO a -> IO a)
>
> mask :: (Mask -> IO a) -> IO a
> mask io = do
>  b <- blocked
>  if b
>then io (Mask id)
>else block $ io (Mask unblock)
>
> restore :: Mask -> IO a -> IO a
> restore (Mask f) a = f a
> --
>
> This is useful in an example like this:
>
> forkThen :: IO () -> IO a -> IO a
> forkThen io k = mask $ \m ->
>  do tid <- forkIO (restore m io)
> restore m k `catch` \e ->
>   do when (e == ThreadKilled) (killThread tid)
>  throwIO e
>
> -Iavor
>
>
> On Thu, Apr 8, 2010 at 1:23 AM, Simon Marlow  wrote:
>> On 07/04/2010 18:54, Isaac Dupree wrote:
>>>
>>> On 04/07/10 11:12, Simon Marlow wrote:

 It's possible to mis-use the API, e.g.

 getUnmask = mask return
>>>
>>> ...incidentally,
>>> unmask a = mask (\restore -> return restore) >>= (\restore -> restore a)
>>
>> That doesn't work, as in it can't be used to unmask exceptions when they
are
>> masked.  The 'restore' you get just restores the state to its current,
i.e.
>> masked, state.
>>
 mask :: ((IO a -> IO a) -> IO b) -> IO b
>>>
>>> It needs to be :: ((forall a. IO a -> IO a) -> IO b) -> IO b
>>> so that you can use 'restore' on two different pieces of IO if you need
>>> to. (alas, this requires not just Rank2Types but RankNTypes. Also, it
>>> doesn't cure the loophole. But I think it's still essential.)
>>
>> Sigh, yes I suppose that's true, but I've never encountered a case where
I
>> needed to call unmask more than once, let alone at different types,
within
>> the scope of a mask.  Anyone else?
>>
>> Cheers,
>>Simon
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-10 Thread Iavor Diatchki
Hello,
It seems that rank-2 types are sufficient to make the more polymorphic types:


{-# LANGUAGE Rank2Types #-}
import Control.Exception

data Mask = Mask (forall a. IO a -> IO a)

mask :: (Mask -> IO a) -> IO a
mask io = do
 b <- blocked
 if b
then io (Mask id)
else block $ io (Mask unblock)

restore :: Mask -> IO a -> IO a
restore (Mask f) a = f a
--

This is useful in an example like this:

forkThen :: IO () -> IO a -> IO a
forkThen io k = mask $ \m ->
  do tid <- forkIO (restore m io)
 restore m k `catch` \e ->
   do when (e == ThreadKilled) (killThread tid)
  throwIO e

-Iavor


On Thu, Apr 8, 2010 at 1:23 AM, Simon Marlow  wrote:
> On 07/04/2010 18:54, Isaac Dupree wrote:
>>
>> On 04/07/10 11:12, Simon Marlow wrote:
>>>
>>> It's possible to mis-use the API, e.g.
>>>
>>> getUnmask = mask return
>>
>> ...incidentally,
>> unmask a = mask (\restore -> return restore) >>= (\restore -> restore a)
>
> That doesn't work, as in it can't be used to unmask exceptions when they are
> masked.  The 'restore' you get just restores the state to its current, i.e.
> masked, state.
>
>>> mask :: ((IO a -> IO a) -> IO b) -> IO b
>>
>> It needs to be :: ((forall a. IO a -> IO a) -> IO b) -> IO b
>> so that you can use 'restore' on two different pieces of IO if you need
>> to. (alas, this requires not just Rank2Types but RankNTypes. Also, it
>> doesn't cure the loophole. But I think it's still essential.)
>
> Sigh, yes I suppose that's true, but I've never encountered a case where I
> needed to call unmask more than once, let alone at different types, within
> the scope of a mask.  Anyone else?
>
> Cheers,
>        Simon
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: persist and retrieve of IO type?

2010-04-10 Thread Svein Ove Aas
On Sat, Apr 10, 2010 at 7:32 PM, Daryoush Mehrtash  wrote:
> Can you please explain this:
>
>> the parameters baked into the  thunk may be infinite
>
I'm a bit bushed today, I think..

I was thinking of thunks. A haskell value can be infinite, since it's
lazily evaluated; however, at the machine level a thunk is just a
function pointer plus a bunch of value (possibly meaning other thunk)
references - eminently walkable, assuming the GHC developers don't
decide to alter the format.

So, there are two ways a function serializer could work, taking
currying into account:

- Store the function pointer (or, preferably, the matching symbol
name), force all the values and write those out along with it. This
has the advantage of being less likely to break on upgrades, but since
the values may be infinite.. yeah.
- Store the function pointer, and walk the value references, storing
the entire tree of thunks/function pointers pointed to by the original
function value, but don't force any values. This at least guarantees
that the serialized form is finite.

All things considered, I'll be shooting for option #2.


-- 
Svein Ove Aas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: persist and retrieve of IO type?

2010-04-10 Thread Daryoush Mehrtash
Can you please explain this:

the parameters baked into the  thunk may be infinite
>


daryoush


On Sat, Apr 10, 2010 at 6:27 AM, Svein Ove Aas  wrote:

> On Sat, Apr 10, 2010 at 11:19 AM, Jon Fairbairn
>  wrote:
> > It sounds more like he wants two functions something like
> >
> > save:: FilePath -> [IO ()] -> IO ()
> > restore:: FilePath -> IO [IO ()]
> >
> > to which the answer would be no.
> >
> It's an insoluble problem in general - the parameters baked into the
> thunk may be infinite, or at least too large to persist, and the
> functions may not be around if you try to load the persisted data into
> a different version of the executable - but it's an interesting
> problem to attempt solving.
>
> Given that GHC 6.12 has added some of the base functionality required
> (i.e. dynamic linking), I was planning to take a bash at it
> (persisting functions in general, not just IO actions) in the summer.
>
> I don't know if that would help you, though. It's certainly not a good
> idea in general, and at any rate there's a good chance I won't
> succeed.
>
> (Of course, thunks aren't /actually/ infinite, in memory. Part of the
> project would be an attempt to persist the thunks, allowing lazy
> evaluation after reading them back in. Naturally this would only work
> with the exact same executable, but that's not necessarily a problem.)
>
> --
> Svein Ove Aas
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] unlifted types in classes

2010-04-10 Thread Phyx
Hi all,

I was wondering if it's possible to have a class declaration that would
except both unlifted types and lifted types as instances.

 

For instance, I'm looking for something like

 

class Foo a b where

bar :: a -> b

 

instance Foo Int Int where

 bar = id

 

instance Foo Int# Int where

 bar = iBox

 

Regards,

Phyx

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Length of lists within list of lists?

2010-04-10 Thread Alexandru Scvortov
someMethod :: [[a]] -> [Int]
someMethod = map length

There's a list, haskell-beginners better suited for this kind of question.

Alex

On Saturday 10 April 2010 18:02:37 boblettoj wrote:
> Hi i want to know if there is any method i can use to count the number of
> items in each list in a list of lists, eg.
> 
> someMethod [[a, b, c], [a], [b, d, e, f]]
> would return [3, 1, 4]
> 
> is there anything that can do this?
> thanks
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Length of lists within list of lists?

2010-04-10 Thread boblettoj

Ah yes of course, thankyou!


boblettoj wrote:
> 
> Hi i want to know if there is any method i can use to count the number of
> items in each list in a list of lists, eg.
> 
> someMethod [[a, b, c], [a], [b, d, e, f]]
> would return [3, 1, 4]
> 
> is there anything that can do this?
> thanks
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Length-of-lists-within-list-of-lists--tp28203363p28203397.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Length of lists within list of lists?

2010-04-10 Thread aditya siram
You need a method that will find the length of a list:
length :: [a] -> Int
and a method that will applies a function to every element of a list
and make a list of the results:
map :: (a ->b) -> [a] -> [b]

Try and put them together.

hth,
-deech



On 4/10/10, boblettoj  wrote:
>
> Hi i want to know if there is any method i can use to count the number of
> items in each list in a list of lists, eg.
>
> someMethod [[a, b, c], [a], [b, d, e, f]]
> would return [3, 1, 4]
>
> is there anything that can do this?
> thanks
>
> --
> View this message in context:
> http://old.nabble.com/Length-of-lists-within-list-of-lists--tp28203363p28203363.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Length of lists within list of lists?

2010-04-10 Thread boblettoj

Hi i want to know if there is any method i can use to count the number of
items in each list in a list of lists, eg.

someMethod [[a, b, c], [a], [b, d, e, f]]
would return [3, 1, 4]

is there anything that can do this?
thanks

-- 
View this message in context: 
http://old.nabble.com/Length-of-lists-within-list-of-lists--tp28203363p28203363.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: persist and retrieve of IO type?

2010-04-10 Thread Stephen Tetley
Hello all

There has been Persistent Haskell - which was one of the Scottish
tradition of persistent languages; being a sassenach myself I've no
knowledge of whether it was actually implemented.

Best wishes

Stephen
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple game: a monad for each player

2010-04-10 Thread Philippa Cowderoy

On 10/04/2010 13:57, Yves Parès wrote:

I answered my own question by reading this monad-prompt example:
http://paste.lisp.org/display/53766

But one issue remains: those examples show how to make play EITHER a human
or an AI. I don't see how to make a human player and an AI play SEQUENTIALLY
(to a TicTacToe, for instance).

   


Make them polymorphic - the human player in any MonadIO, the AI player 
in any monad. Then run them both in the same monad, with some kind of 
wrapping function around the calls setting a context for the appropriate 
player.


--
fli...@flippac.org
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Pictures from Tucson

2010-04-10 Thread Tom Hawkins
http://tomahawkins.org/Pictures/2010
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: persist and retrieve of IO type?

2010-04-10 Thread Svein Ove Aas
On Sat, Apr 10, 2010 at 11:19 AM, Jon Fairbairn
 wrote:
> It sounds more like he wants two functions something like
>
> save:: FilePath -> [IO ()] -> IO ()
> restore:: FilePath -> IO [IO ()]
>
> to which the answer would be no.
>
It's an insoluble problem in general - the parameters baked into the
thunk may be infinite, or at least too large to persist, and the
functions may not be around if you try to load the persisted data into
a different version of the executable - but it's an interesting
problem to attempt solving.

Given that GHC 6.12 has added some of the base functionality required
(i.e. dynamic linking), I was planning to take a bash at it
(persisting functions in general, not just IO actions) in the summer.

I don't know if that would help you, though. It's certainly not a good
idea in general, and at any rate there's a good chance I won't
succeed.

(Of course, thunks aren't /actually/ infinite, in memory. Part of the
project would be an attempt to persist the thunks, allowing lazy
evaluation after reading them back in. Naturally this would only work
with the exact same executable, but that's not necessarily a problem.)

-- 
Svein Ove Aas
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple game: a monad for each player

2010-04-10 Thread Yves Parès

I answered my own question by reading this monad-prompt example:
http://paste.lisp.org/display/53766

But one issue remains: those examples show how to make play EITHER a human
or an AI. I don't see how to make a human player and an AI play SEQUENTIALLY
(to a TicTacToe, for instance).


Yves Parès wrote:
> 
> Thanks,
> I looked at the operational package (since it seemed simpler).
> I see its interest when building sets of operations.
> I think I see how I could apply it to my current problem. I saw in the
> tutorial the sentence: "The ability to write multiple interpreters is also
> very useful for implementing games, specifically to account for both human
> and computer opponents as well as replaying a game from a script."
> So I'm supposed to write 2 functions, one interpretHuman (running in IO,
> and prompting the user), and one interpretAI (running in Identity)?
> 
> Are there examples of such games using operational?
> 
> 
> Heinrich Apfelmus wrote:
>> 
>> Gwern Branwen wrote:
>>> Yves Parès  wrote:
 [...]
 But when running the game, the program cannot "switch" from a player's
 monad
 to another.

 Do you have any suggestion?
>>> 
>>> Your desires remind me of the MonadPrompt package
>>> , which IIRC, has been
>>> used in some game demos to provide abstraction from IO/test
>>> harness/pure AI etc.
>> 
>> The game demo can be found by chasing links from the package
>> documentation:
>> 
>>http://int-e.home.tlink.de/haskell/solitaire.tar.gz
>> 
>> 
>> There's also my package "operational"
>> 
>>http://hackage.haskell.org/package/operational
>> 
>> which implements the same concept. It's throughly explained here:
>> 
>>http://apfelmus.nfshost.com/articles/operational-monad.html
>>http://projects.haskell.org/operational/
>> 
>> 
>> Regards,
>> Heinrich Apfelmus
>> 
>> --
>> http://apfelmus.nfshost.com
>> 
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>> 
>> 
> 
> 


-
Yves Parès

Live long and prosper
-- 
View this message in context: 
http://old.nabble.com/Simple-game%3A-a-monad-for-each-player-tp28183930p28201834.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple game: a monad for each player

2010-04-10 Thread Yves Parès

Thanks,
I looked at the operational package (since it seemed simpler).
I see its interest when building sets of operations.
I think I see how I could apply it to my current problem. I saw in the
tutorial the sentence: "The ability to write multiple interpreters is also
very useful for implementing games, specifically to account for both human
and computer opponents as well as replaying a game from a script."
So I'm supposed to write 2 functions, one interpretHuman (running in IO, and
prompting the user), and one interpretAI (running in Identity)?

Are there examples of such games using operational?


Heinrich Apfelmus wrote:
> 
> Gwern Branwen wrote:
>> Yves Parès  wrote:
>>> [...]
>>> But when running the game, the program cannot "switch" from a player's
>>> monad
>>> to another.
>>>
>>> Do you have any suggestion?
>> 
>> Your desires remind me of the MonadPrompt package
>> , which IIRC, has been
>> used in some game demos to provide abstraction from IO/test
>> harness/pure AI etc.
> 
> The game demo can be found by chasing links from the package
> documentation:
> 
>http://int-e.home.tlink.de/haskell/solitaire.tar.gz
> 
> 
> There's also my package "operational"
> 
>http://hackage.haskell.org/package/operational
> 
> which implements the same concept. It's throughly explained here:
> 
>http://apfelmus.nfshost.com/articles/operational-monad.html
>http://projects.haskell.org/operational/
> 
> 
> Regards,
> Heinrich Apfelmus
> 
> --
> http://apfelmus.nfshost.com
> 
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 


-
Yves Parès

Live long and prosper
-- 
View this message in context: 
http://old.nabble.com/Simple-game%3A-a-monad-for-each-player-tp28183930p28201466.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Hackage accounts and real names

2010-04-10 Thread Heinrich Apfelmus
Steve Schafer wrote:
> Heinrich Apfelmus wrote:
> 
>> I agree, and this is why I phased out "apfelmus" in favor of the
>> pseudonym "Heinrich Apfelmus".
> 
> You mean your name isn't really "Applesauce"?

I would probably apply for a name change if it were. ;)


Regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: persist and retrieve of IO type?

2010-04-10 Thread Jon Fairbairn
Ivan Lazar Miljenovic  writes:

> Daryoush Mehrtash  writes:
>
>> Is there a way to persist a [IO ()] to say a file then retrieve it later and
>> execute it using a sequence function?
>
> I'm not sure I understand what you're wanting... you can pass around
> values of type "IO ()" around, but they won't be executed until you
> actually use them...

It sounds more like he wants two functions something like

save:: FilePath -> [IO ()] -> IO ()
restore:: FilePath -> IO [IO ()]

to which the answer would be no.
-- 
Jón Fairbairn jon.fairba...@cl.cam.ac.uk


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What is the consensus about -fwarn-unused-do-bind ?

2010-04-10 Thread Ivan Miljenovic
On 10 April 2010 02:07, Bryan O'Sullivan  wrote:
> Personally, I find it to be tremendously noisy and unhelpful, and I always
> edit my .cabal files to turn it off. I think of it as a usability
> regression.

Yeah, I'm very tempted to do this as well.  This warning might make
sense for IO, but I think it's of less use for other monads.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What is the consensus about -fwarn-unused-do-bind ?

2010-04-10 Thread Ivan Miljenovic
On 10 April 2010 00:20, Neil Brown  wrote:
> The comments in that bug report actually mention "My patch does not warn on
> uses of >>, only in do-notation, where the situation is more clear cut".  I
> take >> to be an explicit sign that the user wants to ignore the result of
> the first action, whereas in do-notation it may be an accident.  So I think
> it was the right decision.

Ahhh, I missed that bit.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe