
2015-01-25 22:47 GMT+01:00 Tom Ellis < tom-lists-haskell-cafe-2013@jaguarpaw.co.uk>:
2015-01-25 9:37 GMT+01:00 Tom Ellis < tom-lists-haskell-cafe-2013@jaguarpaw.co.uk>:
data ImapF next = Select DirectoryName (Maybe DirectoryDescription -> next) | Noop (DirectoryDescription -> next) | Search MailSearch (Maybe [UID] -> next) -- Functor instance type Imap = Free ImapF
searchAll :: Imap (Maybe [UID]) searchAll = liftF $ Search undefined id select :: DirectoryName -> Imap (Maybe DirectoryDescription) select directory = liftF $ Select directory id
My main problem is the following: if I do a select of an unknown
On Sat, Jan 24, 2015 at 07:46:52PM +0100, Gautier DI FOLCO wrote: directory,
I should stop the computation.
What do you mean you "should stop the computation"? Do you mean the interpretation of the free monad should be forced to stop? If so, doesn't making the type of the `Select` constructor
Select DirectoryName (DirectoryDescription -> next)
achieve this? That way if the interpreter talks issues a select command to the server and fails to receive a `DirectoryDescription` in return
On Sun, Jan 25, 2015 at 10:39:48PM +0100, Gautier DI FOLCO wrote: then it
is forced to stop.
If I do it this way, the evaluation is forced to be stopped, I have no way to react to this error.
Could you explain more precisely what you are trying to achieve, perhaps with an example?
Tom _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
In fact I'm looking for a practical way to alter Imap to change it temporarily or not, globally or locally in a failable monad. Example: select "Unknown" -- will fail doSomethingUnrelated failableLessMode select "Unknown" -- will fail doSomethingUnrelated -- unreached expression -- or select "Unknown" $ do-- will fail doSomethingUnrelated -- unreached expression where :: Imap (Maybe a) -> (a -> Imap b) -> Imap (Maybe b) Is it clearer? Please let me know. Thanks.