Re: [Haskell-cafe] Which generic zipper?
Note that syz is essentially based on Data.Data, which is no less official than GHC.Generics. (The compiler can derive Data with -XDeriveDataTypeable.) I am not sure what your primary concern is. In case you are concerned with the ease of deriving generic instances, almost every generics library out there, including traverse-with-class, provides a TH function for deriving the necessary instances. You can write a zipper based on GHC.Generics, but it won't be a straightforward translation of syz (nor would it be a trivial undertaking). Roman * Luke Evans l...@eversosoft.com [2013-04-10 16:38:17-0700] Hmm, in my naivety I failed to notice that the 'official' GHC.Generics are completely different to SYB on which syz is built. Classic case of reading the same words/names and assuming they're exactly the same thing. Maybe it's not that hard to rewrite syz in terms of GHC.Generics.Generic (I'll perhaps take a look), but maybe there's a generic Zipper library already based on the GHC stuff? On 2013-04-10, at 3:19 PM, Roman Cheplyaka r...@ro-che.info wrote: ...Apart from that, I am not aware of any problems with syz. Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Web servers: Running them multiple times in a ghci session
On Thu, Apr 11, 2013 at 12:33 AM, Niklas Hambüchen m...@nh2.me wrote: I'm writing a web server app, which I run in ghci: :main localhost 8000 Unfortunately, after Ctrl-C and :reload, running it again: ** Exception: bind: resource busy (Address already in use) This is pretty annoying, because quitting-and-restarting takes a lot of time since I have many dependencies. How do you deal with this? Can you propose some working code that can be wrapped around my main function to make it work? Just a guess: it probably has to do with `SO_REUSEADDR`; see this old thread[1] and the comments on `Network.listenOn`[2]. You most likely want to set the `ReuseAddr` option to 1 on your socket with`Network.Socket.setSocketOption`.[3] [1]: http://www.haskell.org/pipermail/beginners/2010-June/004334.html [2]: http://hackage.haskell.org/packages/archive/network/2.4.1.2/doc/html/Network.html [3]: http://hackage.haskell.org/packages/archive/network/2.4.1.2/doc/html/Network-Socket.html#t:SocketOption ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Which generic zipper? [RESOLVED]
Thanks Roman. I'll probably go with Data.Data then. Certainly, I'm not looking for any significant distractions and I'll heed your cautionary note. I read that GHC.Generics is fit and fast in comparison to SYB, but that's not really a big concern for me at the moment. I just fell in to believing that GHC.Generics was the true religion given its apparent status as the adopted generics in GHC. On 2013-04-10, at 11:24 PM, Roman Cheplyaka r...@ro-che.info wrote: Note that syz is essentially based on Data.Data, which is no less official than GHC.Generics. (The compiler can derive Data with -XDeriveDataTypeable.) You can write a zipper based on GHC.Generics, but it won't be a straightforward translation of syz (nor would it be a trivial undertaking). Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Which generic zipper? [RESOLVED]
Hi Luke, Even though you might have made up your mind already, here's some more info. If you want a zipper that does not use Typeable (and thus runtime type comparison and casting, which are potentially inefficient), you can use the zipper in Multirec [1]. Creating a zipper based on GHC.Generics should be easy taking the zipper based on instant-generics [2], or you can just use Sean Leather's rendering [3]. Cheers, Pedro [1] http://hackage.haskell.org/package/multirec [2] http://hackage.haskell.org/package/instant-zipper [3] https://github.com/spl/generic-deriving-extras On Thu, Apr 11, 2013 at 8:44 AM, Luke Evans l...@eversosoft.com wrote: Thanks Roman. I'll probably go with Data.Data then. Certainly, I'm not looking for any significant distractions and I'll heed your cautionary note. I read that GHC.Generics is fit and fast in comparison to SYB, but that's not really a big concern for me at the moment. I just fell in to believing that GHC.Generics was the true religion given its apparent status as the adopted generics in GHC. On 2013-04-10, at 11:24 PM, Roman Cheplyaka r...@ro-che.info wrote: Note that syz is essentially based on Data.Data, which is no less official than GHC.Generics. (The compiler can derive Data with -XDeriveDataTypeable.) You can write a zipper based on GHC.Generics, but it won't be a straightforward translation of syz (nor would it be a trivial undertaking). Roman ___ 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] Set monad
The question of Set monad comes up quite regularly, most recently at http://www.ittc.ku.edu/csdlblog/?p=134 Indeed, we cannot make Data.Set.Set to be the instance of Monad type class -- not immediately, that it. That does not mean that there is no Set Monad, a non-determinism monad that returns the set of answers, rather than a list. I mean genuine *monad*, rather than a restricted, generalized, etc. monad. It is surprising that the question of the Set monad still comes up given how simple it is to implement it. Footnote 4 in the ICFP 2009 paper on ``Purely Functional Lazy Non-deterministic Programming'' described the idea, which is probably folklore. Just in case, here is the elaboration, a Set monad transformer. {-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-} module SetMonad where import qualified Data.Set as S import Control.Monad.Cont -- Since ContT is a bona fide monad transformer, so is SetMonadT r. type SetMonadT r = ContT (S.Set r) -- These are the only two places the Ord constraint shows up instance (Ord r, Monad m) = MonadPlus (SetMonadT r m) where mzero = ContT $ \k - return S.empty mplus m1 m2 = ContT $ \k - liftM2 S.union (runContT m1 k) (runContT m2 k) runSet :: (Monad m, Ord r) = SetMonadT r m r - m (S.Set r) runSet m = runContT m (return . S.singleton) choose :: MonadPlus m = [a] - m a choose = msum . map return test1 = print = runSet (do n1 - choose [1..5] n2 - choose [1..5] let n = n1 + n2 guard $ n 7 return n) -- fromList [2,3,4,5,6] -- Values to choose from might be higher-order or actions test1' = print = runSet (do n1 - choose . map return $ [1..5] n2 - choose . map return $ [1..5] n - liftM2 (+) n1 n2 guard $ n 7 return n) -- fromList [2,3,4,5,6] test2 = print = runSet (do i - choose [1..10] j - choose [1..10] k - choose [1..10] guard $ i*i + j*j == k * k return (i,j,k)) -- fromList [(3,4,5),(4,3,5),(6,8,10),(8,6,10)] test3 = print = runSet (do i - choose [1..10] j - choose [1..10] k - choose [1..10] guard $ i*i + j*j == k * k return k) -- fromList [5,10] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] unsafeInterleaveST (and IO) is really unsafe [was: meaning of referential transparency]
On Thu, Apr 11, 2013 at 12:49:40PM +1200, Richard A. O'Keefe wrote: On 10/04/2013, at 2:45 PM, o...@okmij.org wrote: ... unsafeInterleaveST is really unsafe ... import Control.Monad.ST.Lazy (runST) import Control.Monad.ST.Lazy.Unsafe (unsafeInterleaveST) import Data.STRef.Lazy bad_ctx :: ((Bool,Bool) - Bool) - Bool bad_ctx body = body $ runST (do r - newSTRef False x - unsafeInterleaveST (writeSTRef r True return True) y - readSTRef r return (x,y)) t1 = bad_ctx $ \(x,y) - x == y -- True t2 = bad_ctx $ \(x,y) - y == x -- False [...] I don't understand what it does or *how* it breaks this code. Does it involve side effects being reordered in some weird way? As I understand it, unsafeInterleaveST defers the computation of x, so * if x is forced before y, then writeSTRef r True is run before readSTRef r, thus the latter yields True * if y is forced before x, then writeSTRef r True is run after readSTRef r, thus the latter yields False Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Set monad
One problem with such monad implementations is efficiency. Let's define step :: (MonadPlus m) = Int - m Int step i = choose [i, i + 1] -- repeated application of step on 0: stepN :: (Monad m) = Int - m (S.Set Int) stepN = runSet . f where f 0 = return 0 f n = f (n-1) = step Then `stepN`'s time complexity is exponential in its argument. This is because `ContT` reorders the chain of computations to right-associative, which is correct, but changes the time complexity in this unfortunate way. If we used Set directly, constructing a left-associative chain, it produces the result immediately: step' :: Int - S.Set Int step' i = S.fromList [i, i + 1] stepN' :: Int - S.Set Int stepN' 0 = S.singleton 0 stepN' n = stepN' (n - 1) `setBind` step' where setBind k f = S.foldl' (\s - S.union s . f) S.empty k See also: Constructing efficient monad instances on `Set` (and other containers with constraints) using the continuation monad http://stackoverflow.com/q/12183656/1333025 Best regards, Petr Pudlak 2013/4/11 o...@okmij.org The question of Set monad comes up quite regularly, most recently at http://www.ittc.ku.edu/csdlblog/?p=134 Indeed, we cannot make Data.Set.Set to be the instance of Monad type class -- not immediately, that it. That does not mean that there is no Set Monad, a non-determinism monad that returns the set of answers, rather than a list. I mean genuine *monad*, rather than a restricted, generalized, etc. monad. It is surprising that the question of the Set monad still comes up given how simple it is to implement it. Footnote 4 in the ICFP 2009 paper on ``Purely Functional Lazy Non-deterministic Programming'' described the idea, which is probably folklore. Just in case, here is the elaboration, a Set monad transformer. {-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-} module SetMonad where import qualified Data.Set as S import Control.Monad.Cont -- Since ContT is a bona fide monad transformer, so is SetMonadT r. type SetMonadT r = ContT (S.Set r) -- These are the only two places the Ord constraint shows up instance (Ord r, Monad m) = MonadPlus (SetMonadT r m) where mzero = ContT $ \k - return S.empty mplus m1 m2 = ContT $ \k - liftM2 S.union (runContT m1 k) (runContT m2 k) runSet :: (Monad m, Ord r) = SetMonadT r m r - m (S.Set r) runSet m = runContT m (return . S.singleton) choose :: MonadPlus m = [a] - m a choose = msum . map return test1 = print = runSet (do n1 - choose [1..5] n2 - choose [1..5] let n = n1 + n2 guard $ n 7 return n) -- fromList [2,3,4,5,6] -- Values to choose from might be higher-order or actions test1' = print = runSet (do n1 - choose . map return $ [1..5] n2 - choose . map return $ [1..5] n - liftM2 (+) n1 n2 guard $ n 7 return n) -- fromList [2,3,4,5,6] test2 = print = runSet (do i - choose [1..10] j - choose [1..10] k - choose [1..10] guard $ i*i + j*j == k * k return (i,j,k)) -- fromList [(3,4,5),(4,3,5),(6,8,10),(8,6,10)] test3 = print = runSet (do i - choose [1..10] j - choose [1..10] k - choose [1..10] guard $ i*i + j*j == k * k return k) -- fromList [5,10] ___ 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] exp implementation
On Thu, Apr 11, 2013 at 1:38 AM, Christopher Howard christopher.how...@frigidcode.com wrote: Hi. For my own learning, I wanted to see how the exp function is implemented in GHC. I have GHC 7.4.1 source code open, but I'm having trouble figuring out which file the actual function definition is in. I see expFloat(F# x) = F# (expFloat# x) expFloat# is likely a primop; good luck Primops aka primitive operations are generally implemented in the compiler backend as assembly language or Cmm code. Untangling that part of ghc makes my head swim. . -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal-install 1.16.0.2 on Mac
On Thu, Apr 11, 2013 at 1:19 AM, Richard A. O'Keefe o...@cs.otago.ac.nzwrote: On 11/04/2013, at 12:56 PM, Brandon Allbery wrote: Xcode 4.2 and on do not use /Developer at all. You have an older Xcode on your system somehow, which does not understand newer object files; you should remove the entire /Developer tree. (Xcode, in order to be distributable via the App Store, is completely self-contained in /Applications/Xcode.app.) Unfortunately, I cannot. I _am_ able to install stuff, but uninstalling generally gives me problems, and removing /Developer is something I'm not allowed to do. I think you need to discuss that with whoever made that dictum; requiring that a system be broken is not generally a good idea. Many software packages will find it and use outdated programs or frameworks as a result. It really needs to not be there at all. (Newer Xcode should actually complain and tell you to run the removal script on startup, because its presence can even break Xcode under some circumstances.) -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] exp implementation
On 04/11/2013 06:37 AM, Brandon Allbery wrote: On Thu, Apr 11, 2013 at 1:38 AM, Christopher Howard christopher.how...@frigidcode.com mailto:christopher.how...@frigidcode.com wrote: Hi. For my own learning, I wanted to see how the exp function is implemented in GHC. I have GHC 7.4.1 source code open, but I'm having trouble figuring out which file the actual function definition is in. I see expFloat(F# x) = F# (expFloat# x) expFloat# is likely a primop; good luck Primops aka primitive operations are generally implemented in the compiler backend as assembly language or Cmm code. Untangling that part of ghc makes my head swim. . -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com mailto:allber...@gmail.com ballb...@sinenomine.net mailto:ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net I traced it down some more: I think it eventually goes into the compiler/nativeGen section where it is translated into the platform's native version of the function. On my platform, I think this is the expf function from math.h. (See EXP(3)). I find that to be interesting, because it means you could change the output of your programs by altering your standard library. But I guess there are a lot of things you could change by altering your standard library! -- frigidcode.com signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] exp implementation
On 04/11/2013 07:12 AM, Christopher Howard wrote: On 04/11/2013 06:37 AM, Brandon Allbery wrote: I traced it down some more: I think it eventually goes into the compiler/nativeGen section where it is translated into the platform's native version of the function. On my platform, I think this is the expf function from math.h. (See EXP(3)). I find that to be interesting, because it means you could change the output of your programs by altering your standard library. But I guess there are a lot of things you could change by altering your standard library! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe In glibc, it eventual comes down to this approximation, I think (from ./sysdeps/ieee754/flt-32/e_expf.c): code: /* Compute ex2 = 2^n e^(t/512+delta[t]). */ ex2_u.d = __exp_atable[tval+177]; ex2_u.ieee.exponent += (int) n; /* Approximate e^(dx+delta) - 1, using a second-degree polynomial, with maximum error in [-2^-10-2^-28,2^-10+2^-28] less than 5e-11. */ x22 = (0.500496709180453 * dx + 1.001192102037084) * dx + delta; /* ... snip ... */ result = x22 * ex2_u.d + ex2_u.d; -- frigidcode.com signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] unsafeInterleaveST (and IO) is really unsafe [was: meaning of referential transparency]
On 04/10/2013 04:45 AM, o...@okmij.org wrote: ... And yet there exists a context that distinguishes x == y from y ==x. That is, there exists bad_ctx :: ((Bool,Bool) - Bool) - Bool such that *R bad_ctx $ \(x,y) - x == y True *R bad_ctx $ \(x,y) - y == x False I am not sure that the two statements are equivalent. Above you say that the context distinguishes x == y from y == x and below you say that it distinguishes them in one possible run. The function unsafeInterleaveST ought to bear the same stigma as does unsafePerformIO. After all, both masquerade side-effecting computations as pure. Potentially side-effecting computations. There are non-side-effecting uses of unsafePerformIO and unsafeInterleaveST, but verifying this is outside the reach of the type checker. If they have observable side-effects, I'd say the type system has been broken and it does not make sense to have a defined language semantics for those cases. Hopefully even lazy IO will get recommended less, and with more caveats. (Lazy IO may be superficially convenient -- so are the absence of typing discipline and the presence of unrestricted mutation, as many people in Python/Ruby/Scheme etc worlds would like to argue.) In essence, lazy IO provides unsafe constructs that are not named accordingly. (But IO is problematic in any case, partly because it depends on an ideal program being run on a real machine which is based on a less general model of computation.) The complete code: module R where import Control.Monad.ST.Lazy (runST) import Control.Monad.ST.Lazy.Unsafe (unsafeInterleaveST) import Data.STRef.Lazy bad_ctx :: ((Bool,Bool) - Bool) - Bool bad_ctx body = body $ runST (do r - newSTRef False x - unsafeInterleaveST (writeSTRef r True return True) y - readSTRef r return (x,y)) t1 = bad_ctx $ \(x,y) - x == y t2 = bad_ctx $ \(x,y) - y == x I think this context cannot be used to reliably distinguish x == y and y == x. Rather, the outcomes would be arbitrary/implementation defined/undefined in both cases. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [wxhaskell-devel] I would like to know how to use the following events handlers : dropTargetOnData, dropTargetOnDrop, dropTargetOnEnter,
On Tue, 09 Apr 2013 21:54:15 +0200, Luc TAESCH luc.tae...@gmail.com wrote: WxHaskell and DragAndDrop I would like to know how to use the following events handlers : dropTargetOnData, dropTargetOnDrop, dropTargetOnEnter, dropTargetOnDragOver….[1] Could you check if my current believes are corrects : From wx Widgets/ wxPython [2] / [3] / [4] it looks like they need to be used to manage DragAndDrog for non trivial examples. they are not actionable via an existing event like on drag, etc.. I tried and create my own event. but it does not get activated. [7] besides, from the signatures [1], these look like being activated on DropTarget, unlike other events on Reactive/ Windows/Controls . Is It Correct ? Heinrich created its own events onText, (in reactive-Banana) but this is on a Control. [6] Could someone confirm these events effectively worked for them in WxHaskell, and maybe hint how to do that I have tried you attached program and it gave the following tracing: Drag.exe showMeDropDnD handler called: DragMove on Drag activated: on Enter:Point {pointX = 24, pointY = 6} Build info: - Windows XP - GHC version 7.4.2 - wxWidgets-2.9.3 - wxHaskell from https://github.com/atzedijkstra/wxHaskell As no one else has responded so far, I think you are in uncharted territory; wxHaskell is huge and there are not many applications using it. If you have figured it all out, I hope you want to write a HaskellWiki page about it. Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Will Haskell Platform 2012.4.0.0 uninstall cleanly for the installation of 2013.2.0.0
:) -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal-install 1.16.0.2 on Mac
The basic problem is that the University has a strict policy that academic staff must not have root access on any machine that is connected to the University network. I was given an administrator account so that I could resume the printer and install (some) stuff, but /Developer is owned by root, and I will be given root access on the Greek Calends. I would have thought that many organisations would have similar policies. On 12/04/2013, at 2:44 AM, Brandon Allbery wrote: (Newer Xcode should actually complain and tell you to run the removal script on startup, because its presence can even break Xcode under some circumstances.) 4.6.1 was the latest available in March when I installed it, and it _didn't_ complain or tell me to run any removal script. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal-install 1.16.0.2 on Mac
On Thu, Apr 11, 2013 at 7:41 PM, Richard A. O'Keefe o...@cs.otago.ac.nzwrote: The basic problem is that the University has a strict policy that academic staff must not have root access on any machine that is connected to the University network. I was given an administrator account so that I could resume the printer and install (some) stuff, but /Developer is owned by root, and I will be given root access on the Greek Calends. I would have thought that many organisations would have similar policies. Well, yes (I was one of those admins, although not at your university, for many years), but if they are installing machines with both Xcode 4.6 under /Applications and Xcode 4.1 or earlier under /Developer, they are installing broken machines that will fail to build many packages and where Xcode may malfunction. /Developer should not exist on a machine with Xcode 4.2 or later installed, at all. You should contact an administrator about this and have them fix both installed machines and their installation images or maintenance routines (whatever they went with for OS X). sudo /Developer/Library/uninstall-devtools --mode=all If they need an official reference on this, I can dig up the relevant Apple knowledge base article. On 12/04/2013, at 2:44 AM, Brandon Allbery wrote: (Newer Xcode should actually complain and tell you to run the removal script on startup, because its presence can even break Xcode under some circumstances.) 4.6.1 was the latest available in March when I installed it, and it _didn't_ complain or tell me to run any removal script. I have heard that it is sometimes inconsistent about this; sadly, just because it didn't notice the older version doesn't mean the older version won't cause breakage. (As you saw.) -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal-install 1.16.0.2 on Mac
On Apr 11, 2013, at 6:53 PM, Brandon Allbery wrote: /Developer should not exist on a machine with Xcode 4.2 or later installed, at all. Unfortunately this is not completely true - there are some SDKs that still install stuff in /Developer (NVIDIA comes to mind) but it's pretty obvious that it's not XCode-related. Just because you have /Developer present doesn't mean you're harboring an old XCode. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Web servers: Running them multiple times in a ghci session
The problem is that ^C only kills the main thread, but does not kill any child threads that have been spawned. In happstack the Conf has an optional field where you can supply a ThreadGroup. When threads are forked they will be registered with the ThreadGroup, and when you ^C, all those threads can be killed. That obviously has overhead, so by default we do not use it. But for development in GHCi it can be a huge time saver. http://hackage.haskell.org/packages/archive/happstack-server/7.1.7/doc/html/Happstack-Server-Internal-Types.html#t:Conf Perhaps you can do something similar.. - jeremy On Thu, Apr 11, 2013 at 12:03 AM, Niklas Hambüchen m...@nh2.me wrote: I'm writing a web server app, which I run in ghci: :main localhost 8000 Unfortunately, after Ctrl-C and :reload, running it again: ** Exception: bind: resource busy (Address already in use) This is pretty annoying, because quitting-and-restarting takes a lot of time since I have many dependencies. How do you deal with this? Can you propose some working code that can be wrapped around my main function to make it work? My first idea is running main in a separate process. If you have a working idea, please also post it as an answer on http://stackoverflow.com/questions/15890912/how-do-i-terminate-a-socket-server-in-ghci Thanks ___ 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