[Haskell-beginners] Designing TimeOut for Search Algorithm

Leonhard Applis Leonhard.Applis at protonmail.com
Mon Jun 7 05:32:07 UTC 2021


Good Morning, 

I currently want to write a search algorithm with 3 end conditions:
a) Solution Found 
b) N-iterations done 
c) x minutes timeout

I would like to split the function in two pieces, one which is pure with a seed and no timeout, and one time-outed in a monad (IO?).
So 
pureSearch :: Seed -> Iterations -> Maybe Result 
and 
search :: Timeout -> Seed -> Iterations -> IO Maybe Result

Is this a known Pattern? 
Do you know good examples for this behavior? 
Any other recommendations before I start implementing? 

Best
Leonhard
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210607/4516ca68/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 509 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20210607/4516ca68/attachment.sig>


More information about the Beginners mailing list