[Haskell-cafe] admission to graduate program in CS
Hello list, I am a programmer who just got laid off. I have been studying Haskell and learning a lot about CS, *as a hobby*. I have a B.S. from Caltech in engineering (didn't take many CS classes). Now that my options are open, I'd like to think about graduate school in CS which is probably the academic subject I love most in the world. But I didn't take many CS classes in college, and my job was garden-variety programming, mostly to someone else's design and process rules. My real CS experience comes from my hobbies such as learning Haskell. But that leaves me without a way to prove my ability, at least not by showing recent schoolwork or having any recommendations from CS professors. I hardly know anything about how graduate schools evaluate candidates. So what I am wondering is, could I use a demonstration of my self-study to demonstrate ability? I'm not sure what form that would take, but I'm just trying to look at every angle right now. Thanks, Johann ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds
Just to reply to myself once again, System.Event (which isn't hidden) re-exports (un)registerFd and other functions I need for this. So I can implement all this myself. The only thing I can't do is ask the RTS's eventmanager to watch the fds for me, but I can just create my own (new constructor is exposed as well) to keep all fd-watching in 1 thread. So it seems just enough functionality is exposed to do what I'm after. Those GHC devs must be clever guys :) On Mon, Dec 13, 2010 at 8:24 AM, Mathijs Kwik bluescreen...@gmail.com wrote: Yep, that's like the workaround I'm using right now. I create an empty mvar, fire up 2 threads that will wait for an fd and tryPutMVar afterwards. My original thread justs gets the MVar to wait for any of the 2 fd-waiting-threads to complete. But however light threads may be, I still think this might give some overhead, and it's almost the same trick that System/Event/Thread is using internally, although in that case, the putMVar is performed by the event manager thread. As far as I can tell, the behavior isn't hard-coded in the RTS (no need to change that), but applications that use base will tell it to use the mvar-trick as callback. That's why I was hoping to be able to just tell it to use a different callback. But indeed it's a solution for now. I'll just post a feature-request for GHC. Thanks On Mon, Dec 13, 2010 at 3:19 AM, Mitar mmi...@gmail.com wrote: Hi! On Mon, Dec 13, 2010 at 2:14 AM, Antoine Latter aslat...@gmail.com wrote: Can you do it with forkIO? That is, have two light-weight threads, each waiting on a different fd, which perform the same action when one of them wakes up. Or you could wait for each fd in its own thread (those are really light-weight threads) and once some is triggered you spawn another thread which deals with the event, while the original thread goes back into the waiting. Or you can also send data over Chan to another thread which then processes the even (if you need to serialize processing). Mitar ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] admission to graduate program in CS
On Sun, Dec 12, 2010 at 11:57 PM, Johann Bach johann.bach1...@gmail.com wrote: Hello list, I am a programmer who just got laid off. I have been studying Haskell and learning a lot about CS, *as a hobby*. Oh, I just thought of one answer to my own question--- get a good score on the CS GRE. Can I get some comments as to how much that counts toward a strong application? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Taking the TLS package for a spin ... and failing
On Sun, Dec 12, 2010 at 08:13:59PM +0100, Mads Lindstrøm wrote: Hi Haskellers, I am trying to connect a Java client to a Haskell server using the Haskell tls package, and things are not working out for me. There is a lot of steps involved and I do not know what I am doing wrong, so this is a long message. But first I create a private/public key-pair: On Mon, Dec 13, 2010 at 01:22:17AM +0100, Mads Lindstrøm wrote: Hi again, I found a simpler way to test the server connection, but it is still not working. Namely, openssl s_client -connect 192.168.1.6:8000 Hi Mads, This one has to do with the fact that openssl try to send a SSLv2 hello message, which is not yet supported by TLS (and not in the supported Version list in the params if it was). unfortunately lots of clients still do that for compatibility; even though that doesn't buy much since nobody should connect to a pure SSLv2 server. For the openssl cmdline, you can add a simple -ssl3 flag or -tls1 flag to start negociating at the right version straight away. [snip] main, WRITE: SSLv2 client hello message, length = 101 [snip] This lines appears suspicious; I think that's exactly the same problem. I suppose there's a way to instanciate your java SSL connection to SSL3 or TLS1 It would be nice to add support to the SSLv2 hello message directly though, but I don't have any timeline for that to happens. -- Vincent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A home-brew iteration-alike library: some extension quiestions
Well, It looks like with 'transformer' look onto iteratees it is possible to fold two streams without anything except Iteratee, yet some complications arise. Even real zipping. for example merging two sorted streams with output stream sorted, is expressible. More preciesely, I tried to write a separate module (attached) and with careful use of 'runners' I got stack of Iteratee/Enumeratee transformers, that shall do the job. However, typing of the running function and input streams is a mess: t \i e g - mkEnumeration $ enumerateTo g $ mkIteration $ enumerateTo e (mkIteration i) \i e g - mkEnumeration $ enumerateTo g $ mkIteration $ enumerateTo e (mkIteration i) :: Iteratee e2 a s2 (Iteratee e1 a s1 (Enumeratee e r s m)) a - Enumeration e2 a s2 (Iteratee e1 a s1 (Enumeratee e r s m)) - Enumeration e1 a s1 (Enumeratee e r s m) - Enumeration e r s m And lifting of innermost iteratee's 'nextIM' is not sufficient for merge of sorting streams: A separate one must be written. -- | Pure haskell 98 code : datatypes, instances and so on. -- No fundeps/typefamilies: they will go to separate packages module Data.Iteration.Types where import Control.Monad.Trans.Class import Control.Monad.IO.Class newtype Enumeration e r s m = Enumeration { runEnumeration:: m r -- executed if no more input - (e - m r) -- executed if error encountered - (s - Enumeration e r s m - m r) -- executed if there is more input - m r } newtype Enumeratee e r s m a = Enumeratee { runEnumeratee :: ( a - Enumeration e r s m ) -- how to generate tail of enumeration ? - Enumeration e r s m } instance Monad (Enumeratee e r s m) where return a = Enumeratee ( $ a) m = k = Enumeratee $ \c - runEnumeratee m $ \p - runEnumeratee (k p) c instance Functor (Enumeratee e r m s) where fmap f m = m = return . f instance MonadTrans (Enumeratee e r s) where lift m = Enumeratee $ \c - Enumeration $ \pr eh ip - do v - m runEnumeration (c v) pr eh ip instance MonadIO m = MonadIO (Enumeratee e r s m) where liftIO = lift . liftIO yield :: s - Enumeratee e r s m () yield s = Enumeratee $ \c - Enumeration $ \ _ _ n - n s $ c () failE :: e - Enumeratee e r s m a failE e = Enumeratee $ \_ - Enumeration $ \_ eh _ - eh e stopE :: Enumeratee e r s m a stopE = Enumeratee $ \_ - Enumeration $ \r _ _ - r mkEnumeration :: Enumeratee e r s m a - Enumeration e r s m mkEnumeration e = runEnumeratee e $ const $ Enumeration $ \pr _ _ - pr enumerateTo :: Enumeration e r s m - Iteration e r s m - m r enumerateTo = flip runIteration -- newtype Iteration e r s m = Iteration { runIteration :: Enumeration e r s m - m r } newtype Iteratee e r s m a = Iteratee { runIteratee :: ( a - Iteration e r s m ) - Iteration e r s m } instance Monad (Iteratee e r s m) where return a = Iteratee ($ a) m = k = Iteratee $ \c - runIteratee m $ \ a - runIteratee (k a) c instance Functor (Iteratee e r s m) where fmap f m = m = return . f instance MonadTrans (Iteratee e r s) where lift m = Iteratee $ \c - Iteration $ \e - do v - m runIteration (c v) e instance MonadIO m = MonadIO (Iteratee e r s m) where liftIO = lift . liftIO stopI :: Monad m = r - Iteratee e r s m a stopI r = Iteratee $ \_ - Iteration $ \_ - return r stopIM :: m r - Iteratee e r s m a stopIM r = Iteratee $ \_ - Iteration $ \_ - r nextI :: Monad m = r - (e - r) - Iteratee e r s m s nextI pr eh = Iteratee $ \c - Iteration $ \e - runEnumeration e (return pr) (return . eh) $ \s e' - runIteration (c s) e' nextIM :: m r - (e - m r) - Iteratee e r s m s nextIM pr eh = Iteratee $ \c - Iteration $ \e - runEnumeration e pr eh $ \s e' - runIteration (c s) e' mkIteration :: Monad m = Iteratee e a s m a - Iteration e a s m mkIteration i = runIteratee i $ \v - Iteration $ \_ - return v -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A home-brew iteration-alike library: some extension quiestions
From: Permjacov Evgeniy permea...@gmail.com Hi. I Wrote a simple iteration library. It was not intensively tested, so it MAY contatin bugs, but it is very unlikely. The library is currently on github: https://github.com/permeakra/iteration I'm not ready to upload it to hackage, as some testing and extension is really needed. However, I'd like to know about possible flaws. Current goal is addition of byte-stream (de)compression and IO functions extenstion. After this package will be cabalized and uploaded to hackage. So, while design is not frozen yet, I'm interested in criticism -)/ First, I haven't examined your code in sufficient depth to fully understand it, so I may be off the mark with this comment. However, I'm not convinced it's possible to safely implement zipping in iteration-style IO without another technique (e.g. monadic regions), by which I mean I suspect any code which exposes enough control to pause an enumeration (or alternatively allows a user-supplied termination check to the enumerator) will also not provide guaranteed finalization/garbage collection of the underlying resource (e.g. handle). I also require zipping of streams, and in fact it is possible with iteratee. I haven't included the code in the library because I was formerly not convinced of its safety. I do think it's safe now, but only by use of a monadic region. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] threadWaitRead and threadWaitWrite on multiple fds
On Mon, Dec 13, 2010 at 9:06 AM, Mathijs Kwik bluescreen...@gmail.com wrote: Just to reply to myself once again, System.Event (which isn't hidden) re-exports (un)registerFd and other functions I need for this. So I can implement all this myself. The only thing I can't do is ask the RTS's eventmanager to watch the fds for me, but I can just create my own (new constructor is exposed as well) to keep all fd-watching in 1 thread. So it seems just enough functionality is exposed to do what I'm after. Those GHC devs must be clever guys :) Bryan and I intend the System.Event API to become more official in the future. It's not quite portable to other implementations yet so you should consider it to be GHC specific (like GHC.Conc) for now. Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Weird error during derive-2.3.0.2 build
On Mon, Dec 13, 2010 at 12:07:25AM +0200, Alex wrote: Hi all. I am trying to install the yi editor using cabal-install, which in turns installs the package 'derive-2.3.0.2'. I get the following error during derive's compilation: [53 of 58] Compiling Data.Derive.Internal.Traversal ( Data/Derive/Internal/Traversal.hs, dist/build/Data/Derive/Internal/Traversal.o ) Data/Derive/Internal/Traversal.hs:34:0: Illegal instance declaration for `Applicative (Writer w)' (All instance types must be of the form (T t1 ... tn) where T is not a synonym. Use -XTypeSynonymInstances if you want to disable this.) In the instance declaration for `Applicative (Writer w)' cabal: Error: some packages failed to install: derive-2.3.0.2 failed during the building phase. The exception was: ExitFailure 1 The problem appears to be that derive-2.3.0.2 does not work with mtl-2. The newest version of derive does, but yi specifies a dependency on derive-2.3.*. One thing worth trying is to cabal fetch yi cd yi-0.6.2.4 $EDITOR yi.cabal and change the build-depends: derive =2.3 2.4 line to build-depends: derive =2.3 2.5 Then run 'cabal install' to build yi from the local directory. If it works, you should inform the yi maintaner. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] admission to graduate program in CS
On Mon, Dec 13, 2010 at 12:22:25AM -0800, Johann Bach wrote: On Sun, Dec 12, 2010 at 11:57 PM, Johann Bach johann.bach1...@gmail.com wrote: Hello list, I am a programmer who just got laid off. I have been studying Haskell and learning a lot about CS, *as a hobby*. Oh, I just thought of one answer to my own question--- get a good score on the CS GRE. Can I get some comments as to how much that counts toward a strong application? It definitely counts; in particular I think a good score on the CS GRE coupled with a compelling essay (which explained your situation) would make up for the lack of CS on your undergrad transcript. The recommendations could be more of a problem since those generally carry a good deal of weight. Perhaps you can think creatively about recommenders who could speak to your curiosity, self-motivation, work ethic, and other qualities that would make you a good researcher, even if they can't specifically speak to your qualifications in CS. If you think you would do well in a graduate program in CS, then you are probably right: your task now is to think creatively about how to prove it to others, given the constrained medium of the grad school application. Best of luck (and I will insert here a little plug for the programming languages group at U Penn, which is fantastic =) -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A home-brew iteration-alike library: some extension quiestions
From: o...@okmij.org Just for the record: the library IterateeM.hs, uses NO extensions to Haskell98, let alone Haskell2010. The library as written requires LowLevelIO.hs, which uses FFI (which has been Haskell98 addendum and is in proper Haskell2010). The sample code, Wc.hs, for example, is Haskell98. So, the iteratee can be written with no extensions whatsoever. Related to this, IterateeM.hs and LowLevelIO.hs don't use runtime exceptions either, which I consider a particularly nice feature. In particular, IterateeM does not use any monad transformer library (although it could have). I found that the trouble of writing a state monad for a particular state is negligible compared to the pain of choosing a particular monad transformer library, and especially the pain inflicted on the users who have to deal with many a conflicts of monad transformer libraries. The problem was that I wished Zippee. It means that external enumerator must be suspended at some points so Zippee can process elements from both left and right streams in desired order. It makes any other approach I considered impossible to use. The file IterateeN.hs demonstrates zipping two streams together (in lock-step and not in-lockstep). It turns out, the existing Iteratee interface and type suffices. This is described in more detail in: Parallel composition of iteratees: one source to several sinks http://okmij.org/ftp/Streams.html#1enum2iter Parallel composition of streams: several sources to one sink http://okmij.org/ftp/Streams.html#2enum1iter It seems I was mistaken in my last reply. That's what I get for answering before I read through all my weekend email. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Offer to mirror Hackage
On Sat, Dec 11, 2010 at 19:51, Brandon S Allbery KF8NH allb...@ece.cmu.eduwrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/9/10 16:04 , Richard O'Keefe wrote: I thought X is a mirror of Y meant X would be a read-only replica of Y, with some sort of protocol between X and Y to keep X up to date. As long as the material from Y replicated at X is *supposed* to be publicly available, I don't see a security problem here. Only Y accepts updates from outside, and it continues to do whatever authentication it would do without a mirror. The mirror X would *not* accept updates. The above assumes that the operator of the mirror is trustworthy. It wouldn't be difficult for a hostile party to set up a mirror, but then modify the packages to include malware payloads --- if the packages aren't signed. (Or even if they are signed if it's a sufficiently weak algorithm. MD5 is already unusable for the purpose.) How about, as a cheep and cheerful method to get up running. If the premise is that the original server is trustworthy and the mirrors aren't, then: 1) Hash all packages on the original server. 2) Hash goes into a side car file (e.g. packagename.sha) that lives next to the package 3) Modify cabal so that it can install from a mirror, but always gets the hash from the original server. 4) Before install you check the hash is correct. This gives you a few things: 1) Every package downloaded from a mirror is guarenteed to be the same as downloading from the original server. This seems to avoid most peoples security concern. 2) Although there's a transfer from the central server for every download, it's low bandwidth, so he majority of the load is tranfered to the mirror. 3) If the central server goes down a user could elect to ignore the hash, and still get the package. If this isn't enough then you're down the road of a GPG based solution. Setting up some signing keys for packages, distributing the public halves to all clients, etc, etc... If that's the road you want I'd suggest looking at how Debian solved the problem. http://wiki.debian.org/SecureApt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] IO, sequence, lazyness, takeWhile
-- Is it possible to rewrite code written in this style untilQuit = do text - getLine report text if text == quit then return () else untilQuit -- in a style using higher order functions for abstract iteration? For -- example, something along these lines: untilQuit' = (fmap (takeWhile (/= quit))) (sequence $ map (= report) (repeat getLine)) -- The latter version shows the report, but it doesn't stop at the -- appropriate place, so I'm guessing that I'm being bitten by my -- ignorance about the interaction of actions and lazyness. -- For completeness, here's a definition of report report text = do putStrLn $ You wrote ++ text return text ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] reference to DoCon
On Mon, 13 Dec 2010, Serge D. Mechveliani wrote: Dear administration of www.haskell.org, (I am sorry for not finding a more appropriate list for this letter) In old days, my program system DoCon (computer algebra written in Haskell) had its copy on www.haskell.org/docon/ -- if I remember correct. It certainly disappeared on the server migration 2010-11-30. That's not nice. A solution will certainly be to move www.haskell.org/docon/ to community.haskell.org/docon/ and set a redirection from www.haskell.org/docon/. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] IO, sequence, lazyness, takeWhile
On Mon, Dec 13, 2010 at 7:15 AM, Jacek Generowicz jacek.generow...@cern.ch wrote: -- Is it possible to rewrite code written in this style untilQuit = do text - getLine report text if text == quit then return () else untilQuit -- in a style using higher order functions for abstract iteration? For -- example, something along these lines: untilQuit' = (fmap (takeWhile (/= quit))) (sequence $ map (= report) (repeat getLine)) You are asking about standard library functions? Probably, but I think it is cleanest to just write a HOF to encapsulate this pattern. I have used this one before: whileM_ :: (Monad m) = (a - Bool) - m a - m () whileM_ p m = bool (return ()) (whileM p m) . p = m bool :: a - a - Bool - a bool t f True = t bool t f False = f untilQuit = whileM_ (/= quit) (getLine = liftM2 () report return) I find a variant of whileM that returns m [a] particularly handy for collecting events in an event loop. Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC 7.0.1 developer challenges
Hi John, Why don't you use ulimit for this job? $ ulimit -m 32M; ./cpsa Regards, Mathieu On Fri, Dec 10, 2010 at 12:51 PM, John D. Ramsdell ramsde...@gmail.com wrote: Please excuse the grammar errors in my last post. I was very tired. The name of the package that supplies the free function on Linux is procps, not procpc. It's hosted on SourceForge. To compile my program, do the following: $ mv memfree.txt memfree.l $ make LDLIBS=-ll memfree John On Thu, Dec 9, 2010 at 11:36 PM, John D. Ramsdell ramsde...@gmail.com wrote: I found out how to compute a good memory limit for the GHC runtime on Linux systems. One opens /proc/meminfo, and sums the free memory with the reclaimable memory. The memory allocated to file buffers and the disk cache are reclaimable, and can be added to the memory of a growing GHC process. Once you get beyond that memory size, thrashing is in your futures. I have enclosed a short lex program that computes the limit. It's basically what is done by the procpc program called free, except that I printed only the number of interest to a GHC runtime. John ___ 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] GHC-7.01 and intrinsic operations
Is it possible to make GHC-7.0.1 to generate intrinsic instructions instead of calls to C library to compute trigonometric functions? main = do a - readLn print $ sin a I tried -O -msse2 -fllvm and their combinations. Generating assembly always contains calls for computation of sin Pavel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC 7.0.1 developer challenges
Hi Mathieu, Why don't you use ulimit for this job? $ ulimit -m 32M; ./cpsa yes, I was thinking the same thing. Relying exclusively on GHC's ability to limit run-time memory consumption feels like an odd choice for this task. It's nice that this feature exists in GHC, but it's inherently non-portable and outside of the scope of the language. There really ought to be a better way to catch an infinite loop that this. Just my 2 cents Peter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Connecting to a running Haskell program using GHCI
Hi all, I'd like to load a Haskell program into GHCi A and then connect to GHCi A from GHCI B. Is there any way to do this? This would be handy (handier than telnet) for demoing and debugging server applications that use shared resources. -deech ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] IO, sequence, lazyness, takeWhile
Take a look at the monad-loops package. Cheers, Greg On 12/13/2010 06:15 AM, Jacek Generowicz wrote: -- Is it possible to rewrite code written in this style untilQuit = do text - getLine report text if text == quit then return () else untilQuit -- in a style using higher order functions for abstract iteration? For -- example, something along these lines: untilQuit' = (fmap (takeWhile (/= quit))) (sequence $ map (= report) (repeat getLine)) -- The latter version shows the report, but it doesn't stop at the -- appropriate place, so I'm guessing that I'm being bitten by my -- ignorance about the interaction of actions and lazyness. -- For completeness, here's a definition of report report text = do putStrLn $ You wrote ++ text return text ___ 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] Taking the TLS package for a spin ... and failing
Hi Vincent, On Mon, 2010-12-13 at 08:51 +, Vincent Hanquez wrote: that doesn't buy much since nobody should connect to a pure SSLv2 server. For the openssl cmdline, you can add a simple -ssl3 flag or -tls1 flag to start negociating at the right version straight away. Yes, that worked :) [snip] main, WRITE: SSLv2 client hello message, length = 101 [snip] This lines appears suspicious; I think that's exactly the same problem. I suppose there's a way to instanciate your java SSL connection to SSL3 or TLS1 I have tried a little, and it is not easy at least. But I will try some more. Thank you for answering, Mads ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Weird error during derive-2.3.0.2 build
Hi Alex, The latest version of derive is 2.4.1, which has a number of compile fixes for newer compilers. Any package I maintain is tested on GHC 6.10.4, 6.12.3 and 7.0.1 - so this bug should not be present in 2.4.1. Thanks, Neil On Sun, Dec 12, 2010 at 10:07 PM, Alex alex.s...@gmail.com wrote: Hi all. I am trying to install the yi editor using cabal-install, which in turns installs the package 'derive-2.3.0.2'. I get the following error during derive's compilation: [53 of 58] Compiling Data.Derive.Internal.Traversal ( Data/Derive/Internal/Traversal.hs, dist/build/Data/Derive/Internal/Traversal.o ) Data/Derive/Internal/Traversal.hs:34:0: Illegal instance declaration for `Applicative (Writer w)' (All instance types must be of the form (T t1 ... tn) where T is not a synonym. Use -XTypeSynonymInstances if you want to disable this.) In the instance declaration for `Applicative (Writer w)' cabal: Error: some packages failed to install: derive-2.3.0.2 failed during the building phase. The exception was: ExitFailure 1 Of course, I tried to build it with --ghc-option=-XTypeSynonymInstances, which in turn gives another compilation error. I am using ubuntu maverick 32-bit, with ghc-6.12.1 and cabal-install 0.8.2. The ghc was installed from the package repository. Cabal was installed using: cabal-install cabal Alex. ___ 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] Strong version of 'local' for reader monad
Hi all, Today I wanted this function strongLocal :: (MonadReader r1 m1, MonadReader r2 m2) = (r2 - r1) - m1 a - m2 a Of course, after staring at this type for ten seconds I realized that it cannot be implemented. But I wondered whether anyone has any pointers to anything related, or if anyone has good ideas for a reasonable interface that would allow this. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Monad Syntax
From: A Neighborhood of Infinity Monday, August 07, 2006 You Could Have Invented Monads! (And Maybe You Already Have.) http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html The following part: do let x = 7 y - Writer (x+1,inc\n) z - Writer (2*y,double\n) Writer (z-1,dec\n) The notation is very suggestive. When we write y - ... it's as if we can pretend that the expression on the right hand side is just x+1 and that the side-effect just looks after itself. Why pretend? Couldn't the syntax be: do let x = 7 y - x+1, Writer (inc\n) z - 2*y, Writer (double\n) z-1, Writer (dec\n) Or some other delimiter than the comma? I'm thinking this syntax might be easier to understand. :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] admission to graduate program in CS
Can I get some recommendations for CS textbooks to study for the CS GRE? Note that I am already fluent in C++ and Python (and getting better at Haskell), so I don't need hand-holding in learning the very basics... however, I do need to review the standard theory. For example, if the GRE asks: What are the fundamental elements of OO? I'm actually not sure what the answer is. (There's a difference between using an OO language, and talking about the theory behind it. In garden-variety programming we never talk about the theory.) I assume that any textbook is going to include the basics---I can skim through those parts. But I would be curious if there is a textbook that quickly gets into the deep stuff (and is particularly relevant to the GRE). Thanks, J ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad Syntax
On Monday 13 December 2010 22:06:41, cas...@istar.ca wrote: Why pretend? Couldn't the syntax be: do let x = 7 y - x+1, Writer (inc\n) z - 2*y, Writer (double\n) z-1, Writer (dec\n) Or some other delimiter than the comma? Doesn't work for other monads, I think (nor for the general x - someWriter foo). How would that translate to [], State, IO, ...? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monad Syntax
On Mon, 13 Dec 2010, cas...@istar.ca wrote: do let x = 7 y - x+1, Writer (inc\n) z - 2*y, Writer (double\n) z-1, Writer (dec\n) Or some other delimiter than the comma? You can simply define your own syntax using an infix operator, say: a # str = Writer (a, str) do let x = 7 y - x+1 # inc\n z - 2*y # double\n z-1 # dec\n ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strong version of 'local' for reader monad
Hey Brent, Of course, because your type signature has no valid implementation, the expected semantics are hard to guess. Why should strongLocal bother about the MonadReader constraint on m1 anyway? Are you internally combining it with 'ask' or another 'local'? The monads are potentially different, so m1 has to be run inside m2. A more specific version of strongLocal could be: strongLocalReader :: MonadReader r2 m2 = (r2 - r1) - Reader r1 a - m2 a strongLocalReader f m = do r - asks f return (runReader m r) Or you can generalize it to every 'Runnable' monad: class Monad m = Runnable m where run :: m a - a strongLocalRunnable :: (MonadReader r2 m2, Runnable m1) = (r2 - r1) - (r1 - m1 a) - m2 a strongLocalRunnable f m = do r - asks f return (run (m r)) Is this what you want to express? Cheers, Sebastiaan On Dec 13, 2010, at 9:30 PM, Brent Yorgey wrote: Hi all, Today I wanted this function strongLocal :: (MonadReader r1 m1, MonadReader r2 m2) = (r2 - r1) - m1 a - m2 a Of course, after staring at this type for ten seconds I realized that it cannot be implemented. But I wondered whether anyone has any pointers to anything related, or if anyone has good ideas for a reasonable interface that would allow this. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC 7.0.1 developer challenges
On Mon, Dec 13, 2010 at 10:17 AM, Mathieu Boespflug mb...@tweag.net wrote: Hi John, Why don't you use ulimit for this job? By default, the GHC runtime will allocate memory beyond what it takes for takes to cause thrashing on a Linux box. However, if you give the GHC runtime a limit with the -M option, and it wants too much memory, the GHC runtime is smart enough not to ask for more, but to garbage collect more often. If you ulimit the GHC runtime, the process is killed when it asks for too much memory, right? I have enclosed a small script I contributed in another thread that shows how I tested it. If you run my cpsagraph program on my laptop with a large, but not too large input, the program causes OS thrashing and takes ten minutes to run. If you limit the memory using, the script chooses a limit around 750m, and the program completes in 48 seconds! The top program shows that the program gets 100% of the CPU during the fast run. The script chooses the best memory limit, not too small, and not too big. John #! /bin/sh # Compute the free memory on a Linux system with /proc/meminfo. # Set GHCRTS accordingly. # Source this file or pass it a command to run in the extended environment. GHCRTS=-M`awk ' /^MemFree:/ { free += $2 } /^Buffers:/ { free += $2 } /^Cached:/ { free += $2 } END { print free k }' /proc/meminfo` export GHCRTS if [ -n $1 ] then $@ fi ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC 7.0.1 developer challenges
On Mon, Dec 13, 2010 at 10:45 AM, Peter Simons sim...@cryp.to wrote: Hi Mathieu, ... There really ought to be a better way to catch an infinite loop that this. It all comes down to picking the correct memory limit. How do you propose to do it? How did you come up with the number 32M? That number would have been a disaster for me. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Conditional compilation for different versions of GHC?
A better plan would be to start depending on 'haskell2010' or 'haskell98' and get rid of explicit dependencies on 'base' altogether. Since those are standardized between compilers. John On Tue, Dec 7, 2010 at 6:59 PM, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/7/10 06:00 , Henning Thielemann wrote: Brandon S Allbery KF8NH wrote: Since the base package is (with good reason) part of the compiler, anyone smart enough to get that to work is smart enough to edit the cabal file. There are good reasons for not only bundling 'ghc' package with GHC, but 'base', too? I assumed it is intended to untangle 'base' and GHC in future, such that 'base' can be used with JHC, UHC, Hugs. I seem to recall that the logistics of that change have been proving a bit difficult in practice, and as such it's probably not going to happen very soon. - -- brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkz+9HYACgkQIn7hlCsL25XXPQCfa/x9ZyhUmN88vu3/EPv8Tjhq +5EAniBq3G9gto/IC8kyYFP2rAjTxB/4 =LnDx -END PGP SIGNATURE- ___ 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] Conditional compilation for different versions of GHC?
On 1 December 2010 03:54, Michael Snoyman mich...@snoyman.com wrote: On Wed, Dec 1, 2010 at 4:07 AM, Thomas Schilling nomin...@googlemail.com wrote: I think a nicer way to solve that issue is to use Cabal's MIN_VERSION macros. 1. Add CPP to your extensions. This will cause cabal to auto-generate a file with MIN_VERSION_pkg macros for each pkg in build-depends. 2. GHC 6.12.* comes with template-haskell 2.4, so to test for that use: #ifdef MIN_VERSION_template_haskell(2,4,0) .. ghc-6.12.* code here. #endif This should make it more transparent to the user. Also, I think #if GHC7 ... #endif is more transparent than a check on template-haskell. Note that in many cases it is inappropriate to use the ghc version as a proxy for a library version since most libraries are upgradable independently of GHC. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] admission to graduate program in CS
On Mon, 13 Dec 2010 22:25:07 +0100, Johann Bach johann.bach1...@gmail.com wrote: Can I get some recommendations for CS textbooks to study for the CS GRE? Maybe you can find something at http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/ (the free MIT Open Courseware). Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html -- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Offer to mirror Hackage
On 12/13/10 8:25 AM, Paul Sargent wrote: How about, as a cheep and cheerful method to get up running. If the premise is that the original server is trustworthy and the mirrors aren't, then: 1) Hash all packages on the original server. 2) Hash goes into a side car file (e.g.packagename.sha) that lives next to the package I still contend that we shouldn't have to trust the central server either. The hash can be created alongside the sdist on the maintainer's computer, and then both are uploaded to central. Thus, the maintainer can verify that the hash on central matches their own, which ensures that: (a) the hash that central has is trustworthy (b) no man-in-the-middle corrupted the sending of the hash to central These concerns are separate from using the hash to confirm the consistency of the sdist itself. Remember: metadata can be compromised just as easily as data. And the fewer machines we have to trust, the better. Moreover, this approach requires the same amount of implementation work as getting central to make the hashes. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Offer to mirror Hackage
On 14/12/2010, at 2:25 AM, Paul Sargent wrote: On Sat, Dec 11, 2010 at 19:51, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/9/10 16:04 , Richard O'Keefe wrote: I thought X is a mirror of Y meant X would be a read-only replica of Y, with some sort of protocol between X and Y to keep X up to date. As long as the material from Y replicated at X is *supposed* to be publicly available, I don't see a security problem here. Only Y accepts updates from outside, and it continues to do whatever authentication it would do without a mirror. The mirror X would *not* accept updates. The above assumes that the operator of the mirror is trustworthy. It wouldn't be difficult for a hostile party to set up a mirror, but then modify the packages to include malware payloads --- if the packages aren't signed. (Or even if they are signed if it's a sufficiently weak algorithm. MD5 is already unusable for the purpose.) True, but right now we're vulnerable to man-in-the-middle attacks, DNS spoofing, and a whole lot of other things. If there is any way to be sure that what I see when I visit hackage.haskell.org is the *real* hackage, my browser doesn't know about it. How about, as a cheep and cheerful method to get up running. If the premise is that the original server is trustworthy and the mirrors aren't, then: 1) Hash all packages on the original server. 2) Hash goes into a side car file (e.g. packagename.sha) that lives next to the package 3) Modify cabal so that it can install from a mirror, but always gets the hash from the original server. 4) Before install you check the hash is correct. This suffers from two problems. A. I am willing to grant that the original server is trustworthy, but DNS lookup gives me the address of the original server and not a spoofer seems every bit as dodgy an assumption as the trustworthiness of the mirrors. B. Wasn't the original motivation for wanting mirrors *availablity*? If you have to get the hash from the original server and the original server is down, then having a mirror has done you no good at all. Perhaps someone on this list understands what CRAN does could explain it here. I know that the R install.packages(...) command goes through mirrors. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] haskell-mpi-1.0.0
Could you please add your package to the wiki section at http://haskell.org/haskellwiki/Applications_and_libraries/Concurrency_and_parallelism#MPI ? On 9 December 2010 21:40, Dmitry Astapov dmi...@well-typed.com wrote: Dear Haskellers, We are pleased to announce the release of haskell-mpi-1.0.0, a suite of Haskell bindings to the C MPI library and convenience APIs on top of it. About MPI - MPI, the Message Passing Interface, is a popular communications protocol for distributed parallel computing (http://www.mpi-forum.org/). MPI applications consist of independent computing processes which share information by message passing. It supports both point-to-point and collective communication operators, and manages much of the mundane aspects of message delivery. There are several high-quality implementations of MPI available, all of which conform to the standard API specification (the latest version of which is 2.2). The MPI specification defines interfaces for C, C++ and Fortran, and bindings are available for many other programming languages. About Haskell-MPI - As the name suggests, Haskell-MPI provides a Haskell interface to MPI, and thus facilitates distributed parallel programming in Haskell. It is implemented on top of the C API via Haskell's foreign function interface. Haskell-MPI provides three different ways to access MPI's functionality: * A direct binding to the C interface (see Control.Parallel.MPI.Internal). * A convenient interface for sending arbitrary serializable Haskell data values as messages (see Control.Parallel.MPI.Simple). * A high-performance interface for working with (possibly mutable) arrays of storable Haskell data types (see Control.Parallel.MPI.Fast). We do not currently provide exhaustive coverage of all the functions and types defined by MPI 2.2, although we do provide bindings to the most commonly used parts. In future we plan to extend coverage based on the needs of projects which use the library. The package is available from http://hackage.haskell.org/package/haskell-mpi. Examples and comprehensive testsuite are included in the source distribution. Code was tested on 32- and 64-bit platforms, with MPICH2 and OpenMPI. The Fast API shows performance comparable to C, and the Simple API is generally 2-7 time slower due to (de)serialization overhead and necessity to issue additional MPI requests behind the curtains in some cases. Bernie Pope started this project as a rewrite of hMPI which was written by Michael Weber and Hal Daume III. He was later joined by Dmitry Astapov, working on the library as part of Well-Typed LLP's Parallel Haskell Project. Development is happening on GitHub, in git://github.com/bjpop/haskell-mpi. Please join in! Sincerely yours, Dmitry Astapov, Bernie Pope -- Dmitry Astapov Well-Typed LLP, http://www.well-typed.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] haskell-mpi-1.0.0
Done. Cheers, Bernie. On 14 December 2010 13:13, Thomas Schilling nomin...@googlemail.com wrote: Could you please add your package to the wiki section at http://haskell.org/haskellwiki/Applications_and_libraries/Concurrency_and_parallelism#MPI ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Offer to mirror Hackage
On Dec 13, 2010, at 6:15 PM, wren ng thornton w...@freegeek.org wrote: On 12/13/10 8:25 AM, Paul Sargent wrote: How about, as a cheep and cheerful method to get up running. If the premise is that the original server is trustworthy and the mirrors aren't, then: 1) Hash all packages on the original server. 2) Hash goes into a side car file (e.g.packagename.sha) that lives next to the package If hashed are added to the package information cabal update downloads, installing packages from mirrors will continue to work during a central outage. I still contend that we shouldn't have to trust the central server either. The hash can be created alongside the sdist on the maintainer's computer, and then both are uploaded to central. Thus, the maintainer can verify that the hash on central matches their own, which ensures that: For now, it's enough to find a simple scheme where adding untrusted mirrors is no worse than the current situation. Hashes seem to work for that: 1. cabal update always reads from the central server (if uploads are impossible when the central server is down, the package lit won't even get stale) 2. The package descriptions are extended with hashes 3. Cabal may download packages from mirrors, but checks the hash. Your proposal doesn't narrow trust to the maintainers (which is currently open to the public anyway), because an adversary as described could return the correct hash and package for the maintainer, and the corrupted version to others. Brandon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe