# News aggregator

### another instance of MonadError

haskell-cafe - Thu, 07/14/2016 - 11:19pm
Hello, IO is an instance of MonadError IOException... However I also need to make it an instance of MonadError String... Is it possible? I'm trying to instanciate this class: class (Typeable n, Monad n, Applicative n, MonadError String n) => EvMgt n where ... instance EvMgt IO where... Any idea? _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
Categories: Offsite Discussion

### Douglas M. Auclair (geophf): 1HaskellADay 1Liners June 2016

Planet Haskell - Thu, 07/14/2016 - 9:22pm
• June 13th, 2016:
You want this list: [1, -1, 1, -1, ...]
How would you produce this value in #Haskell ?
• Wai Lee Chin Feman @wchinfeman
https://gist.github.com/skatenerd/08d70c45499e1610206a
(set plop to be identity, and set transformstate to be (*) -1)
• Philipp Maier @AkiiZedd iterate negate 1’
• Patrick Mylund @pmylund concat $repeat [1, (-1)] • Gary Fixler @gfixler No need for the parens in a list. • Jeff Foster @fffej and Kevin Meredith @Gentmen iterate (* (- 1)) 1 • Spencer Janssen @spencerjanssen and Андреев Кирилл @nonaem00 cycle [1, -1] • Philipp Maier @AkiiZedd: I’m curious: Since concat is O(n) wouldn’t it take more and more time depending on how many items you take? • Patrick Mylund @pmylund Looks like they compile to the same thing https://gist.github.com/patrickmn/9a92ab2a088018b2c0631f3bcfd60ebe • Philipp Maier @AkiiZedd I’m actually surprised the compiler can optimise this away :o Thanks for showing me ddump-simpl! • Eyal Lotem @EyalL concat is foldr (++), not foldl. O(1) work is done to produce the next item. [1,-1]++([1,-1]++(... • David Turner @DaveCTurner I'd actually write 'cycle [1,-1]' but I like the elegant, alliterative obscurity of 'iterate negate 1' • Fatih Karakurt @karakfa alt=1:[-x|x<-alt] Categories: Offsite Blogs ### 14th ACM MobiWac 2016, MALTA General haskell list - Thu, 07/14/2016 - 4:11pm ** We apologize if you receive multiple copies of this message ** ================================================================== The 14th ACM International Symposium on Mobility Management and Wireless Access (MobiWac 2016) November 13 - 17, 2016 - Malta http://mobiwac-symposium.org/ ================================================================== The MOBIWAC series of event is intended to provide an international forum for the discussion and presentation of original ideas, recent results and achievements by researchers, students, and systems developers on issues and challenges related to mobility management and wireless access protocols. To keep up with the technological developments, we also open up new areas such as mobile cloud computing starting from this year. Authors are encouraged to submit both theoretical and practical results of significance on all aspects of wire Categories: Incoming News ### Mark Jason Dominus: Surprising reasons to use a syntax-coloring editor Planet Haskell - Thu, 07/14/2016 - 9:15am [ Danielle Sucher reminded me of this article I wrote in 1998, before I had a blog, and I thought I'd repatriate it here. It should be interesting as a historical artifact, if nothing else. Thanks Danielle! ] I avoided syntax coloring for years, because it seemed like a pretty stupid idea, and when I tried it, I didn't see any benefit. But recently I gave it another try, with Ilya Zakharevich's cperl-mode' for Emacs. I discovered that I liked it a lot, but for surprising reasons that I wasn't expecting. I'm not trying to start an argument about whether syntax coloring is good or bad. I've heard those arguments already and they bore me to death. Also, I agree with most of the arguments about why syntax coloring is a bad idea. So I'm not trying to argue one way or the other; I'm just relating my experiences with syntax coloring. I used to be someone who didn't like it, but I changed my mind. When people argue about whether syntax coloring is a good idea or not, they tend to pull out the same old arguments and dust them off. The reasons I found for using syntax coloring were new to me; I'd never seen anyone mention them before. So I thought maybe I'd post them here. Syntax coloring is when the editor understands something about the syntax of your program and displays different language constructs in different fonts. For example, cperl-mode displays strings in reddish brown, comments in a sort of brick color, declared variables (in my) in gold, builtin function names (defined) in green, subroutine names in blue, labels in teal, and keywords (like my and foreach) in purple. The first thing that I noticed about this was that it was easier to recognize what part of my program I was looking at, because each screenful of the program had its own color signature. I found that I was having an easier time remembering where I was or finding that parts I was looking for when I scrolled around in the file. I wasn't doing this consciously; I couldn't describe the color scheme any particular part of the program was, but having red, gold, and purple blotches all over made it easier to tell parts of the program apart. The other surprise I got was that I was having more fun programming. I felt better about my programs, and at the end of the day, I felt better about the work I had done, just because I'd spent the day looking at a scoop of rainbow sherbet instead of black and white. It was just more cheerful to work with varicolored text than monochrome text. The reason I had never noticed this before was that the other coloring editors I used had ugly, drab color schemes. Ilya's scheme won here by using many different hues. I haven't found many of the other benefits that people say they get from syntax coloring. For example, I can tell at a glance whether or not I failed to close a string properly—unless the editor has screwed up the syntax coloring, which it does often enough to ruin the benefit for me. And the coloring also slows down the editor. But the two benefits I've described more than outweigh the drawbacks for me. Syntax coloring isn't a huge win, but it's definitely a win. If there's a lesson to learn from this, I guess it's that it can be valuable to revisit tools that you rejected, to see if you've changed your mind. Nothing anyone said about it was persuasive to me, but when I tried it I found that there were reasons to do it that nobody had mentioned. Of course, these reasons might not be compelling for anyone else. Addenda 2016 Looking back on this from a distance of 18 years, I am struck by the following thoughts: 1. Syntax higlighting used to make the editor really slow. You had to make a real commitment to using it or not. I had forgotten about that. Another victory for Moore’s law! 2. Programmers used to argue about it. Apparently programmers will argue about anything, no matter how ridiculous. Well okay, this is not a new observation. Anyway, this argument is now finished. Whether people use it or not, they no longer find the need to argue about it. This is a nice example that sometimes these ridiculous arguments eventually go away. 3. I don't remember why I said that syntax highlighting “seemed like a pretty stupid idea”, but I suspect that I was thinking that the wrong things get highlighted. Highlighters usually highlight the language keywords, because they're easy to recognize. But this is like highlighting all the generic filler words in a natural language text. The words you want to see are exactly the opposite of what is typically highlighted. Syntax highlighters should be highlighting the semantic content like expression boundaries, implied parentheses, boolean subexpressions, interpolated variables and other non-apparent semantic features. I think there is probably a lot of interesting work to be done here. Often you hear programmers say things like “Oh, I didn't see the that the trailing comma was actually a period.” That, in my opinion, is the kind of thing the syntax highlighter should call out. How often have you heard someone say “Oh, I didn't see that while there”? 4. I have been misspelling “arguments” as “argmuents” for at least 18 years. Categories: Offsite Blogs ### efficient operations on immutable structures haskell-cafe - Thu, 07/14/2016 - 7:07am Hi again all. From some online research, I understand that operations on complex immutable structures (for example, a "setter" function a -> (Int, Int) -> Matrix -> Matrix which alters one element in the Matrix) is not necessarily inefficient in Haskell, because the (compiler? runtime?) has some means of sharing unchanged values between the input and output structure. What I am not clear on, however, is how this works, and how you ensure that this happens. Could someone perhaps elaborate, or point me to a really good read on the subject? Categories: Offsite Discussion ### Proposal: Add restriction to Data.Map and Data.IntMap libraries list - Thu, 07/14/2016 - 5:45am Cale Gibbard proposes the following: Data.IntMap.restriction :: IntSet -> IntMap a -> IntMap a Data.Map.restriction :: Ord k => Set k -> Map k a -> Map k a In each case, the map is filtered to contain only the keys that are also found in the set. This can be implemented efficiently using a slightly stripped-down version of Data.Map.intersection. David Feuer _______________________________________________ Libraries mailing list Libraries< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries Categories: Offsite Discussion ### Proposal: Add Foldable helper to Control.DeepSeq libraries list - Thu, 07/14/2016 - 4:16am As I describe in https://github.com/haskell/deepseq/issues/17 it is possible to implement an NFData instance for any Foldable type, and we can offer a function to help do that: data Unit = Unit instance Monoid Unit where mempty = Unit Unit mappend Unit = Unit -- strict in both arguments, unlike () rnfFoldable :: (Foldable f, NFData a) => f a -> () rnfFoldable xs = foldMap (\x -> rnf x seq Unit) xs seq () This could be used like so: instance NFData a => NFData (F a) where rnf = rnfFoldable This version forces from left to right. It would be possible to offer another version that forces from right to left: data Unit2 = Unit2 instance Monoid Unit2 where mempty = Unit2 x mappend Unit2 = x seq Unit2 rnfFoldableRTL :: (Foldable f, NFData a) => f a -> () rnfFoldableRTL xs = foldMap (\x -> rnf x seq Unit2) xs seq () _______________________________________________ Libraries mailing list Libraries< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries Categories: Offsite Discussion ### How to support multiple string types in Haskell? haskell-cafe - Thu, 07/14/2016 - 1:40am Hi all, There are multiple string types in Haskell – String, lazy/strict ByteString, lazy/strict Text to name a few. So to make a string handling function maximally reusable, it needs to support multiple string types. One approach used by TagSoup library is to make a type class StringLike which represents the polymorphic string type and uses it where a String type is normally needed. For example, parseTags :: StringLike str => str -> [Tag str] Here parseTags takes a StringLike type instead of a fixed string type. Users of TagSoup can pick any of String, lazy/strict ByteString, lazy/strict Text because they are all instances of StringLike type class. It seems StringLike type class is quite generic but it is used only in the TagSoup package. This makes me wonder what is the idiomatic way to support multiple string types in Haskell. What other approaches do we have? Thanks, Kwang Yul Seo _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view ar Categories: Offsite Discussion ### Use GHC API in standalone executable? haskell-cafe - Wed, 07/13/2016 - 9:54pm Hi, I'd like to compile an executable that internally uses the GHC API, but otherwise does not require users to have GHC installed on their machine. Is this possible? As far as I can tell, lots of functions in the GHC API read package databases per$GHC_PACKAGE_PATH and things of that nature. Thanks, Mitchell _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
Categories: Offsite Discussion

### Can't log into to GHC trac

haskell-cafe - Wed, 07/13/2016 - 2:57pm
Hi, embarrassingly I've forgotten my password (and username) to the GHC trac, and there's no automatic way to reset any of it: - When I try to register an account it says my email address is already in use - To reset my password I need to give both my username and password, but I don't know my username Who can I contact to help resolve the issue? _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
Categories: Offsite Discussion

### Christopher Strachey centenary announcement

General haskell list - Wed, 07/13/2016 - 9:48am
Dear all, This November marks 100 years since the birth of Christopher Strachey. We are holding a symposium to celebrate his life and research in Oxford on Saturday 19th November. There will also be an exhibition of material from the Strachey archive on Friday 18th November, followed by a banquet dinner at Hertford College on the evening of Friday 18th November. For more information and to register for attendance, please go to http://www.cs.ox.ac.uk/strachey100/. ------------------------------- Christopher Strachey (1916–1975) was a pioneering computer scientist and the founder of the Programming Research Group, now part of the Department of Computer Science at Oxford University. Although Strachey was keenly interested in the practical aspects of computing, it is in the theoretical side that he most indelibly left his mark, notably by creating with Dana Scott the denotational (or as he called it, ‘mathematical’) approach to defining the semantics of programming languages—undoubtedly influ
Categories: Incoming News

### ANN: tagsoup-megaparsec-0.1.0.0

haskell-cafe - Tue, 07/12/2016 - 1:23pm
Hello all, I'm pleased to announce the first release of tagsoup-megaparsec, a Tag token parser library. This library helps you build a megaparsec parser using TagSoup's Tags as tokens. https://hackage.haskell.org/package/tagsoup-megaparsec https://github.com/kseo/tagsoup-megaparsec Regards, Kwang Yul Seo _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
Categories: Offsite Discussion

### Mark Jason Dominus: A simple but difficult arithmetic puzzle

Planet Haskell - Tue, 07/12/2016 - 1:13pm

Lately my kids have been interested in puzzles of this type: You are given a sequence of four digits, say 1,2,3,4, and your job is to combine them with ordinary arithmetic operations (+, -, ×, and ÷) in any order to make a target number, typically 24. For example, with 1,2,3,4, you can go with $$((1+2)+3)×4 = 24$$ or with $$4×((2×3)×1) = 24.$$

We were stumped trying to make 6,6,5,2 total 24, so I hacked up a solver; then we felt a little foolish when we saw the solutions, because it is not that hard. But in the course of testing the solver, I found the most challenging puzzle of this type that I've ever seen. It is:

Given 6,6,5,2, make 17.

There are no underhanded tricks. For example, you may not concatenate 2 and 5 to make 25; you may not say and and concatenate 1 and 7 to make ; you may not interpret the 17 as a base 12 numeral, etc.

I hope to write a longer article about solvers in the next week or so.

Categories: Offsite Blogs

### network package and SIGVTALRM

haskell-cafe - Tue, 07/12/2016 - 11:35am
Hi all I am doing a DCC subsystem on a irc client. After all the handshakes are done I just connect to the server and start recv. The code I use for this is: getPackets :: MVar Int -> FilePath -- ^ Name media -> Int -- ^ File size -> AddrInfo -> ExceptT DCCError IO () getPackets mvar name totalSize addr = do receivedSize <- lift $bracket acquire release receive let delta = (totalSize - receivedSize) if delta > 0 then throwE (NotFullRecv delta) else return () where bufferSize = 16384 acquire :: IO (IO.Handle,Socket) acquire = (,) <$> (IO.openFile name IO.WriteMode) <*> newSocket addr release :: (IO.Handle,Socket) -> IO () release (hdl, sock) = IO.hClose hdl >> close sock receive :: (IO.Handle,Socket) -> IO Int receive (hdl, sock) = flip execStateT 0 . fix \$ \loop -> do mediaData <- lift (B.re
Categories: Offsite Discussion

### SPLASH'16: 3rd Combined Call for Contributions toCollocated Events

General haskell list - Mon, 07/11/2016 - 9:40pm
################################################# ACM Conference on Systems, Programming, Languages, and Applications: Software for Humanity (SPLASH'16) ################################################# Amsterdam, The Netherlands Sun 30th October - Fri 4th November , 2016 http://2016.splashcon.org https://twitter.com/splashcon https://www.facebook.com/SPLASHCon/ NEWS! Benjamin Pierce and Andy Ko have agreed to be keynotes for SPLASH'16! Sponsored by ACM SIGPLAN Combined Call for Contributions to Collocated Events: - SPLASH-I, SPLASH-E, Student Research Competition, Programming Languages Mentoring Workshop - Scala Symposium - Workshops: AGERE, DSLDI, DSM, FOSD, ITSLE, LWC< at >SLE, META, MOBILE!, NOOL, PLATEAU, Parsing< at >SLE, REBLS, RUMPLE, SA-MDE, SEPS, VMIL, WODA The ACM SIGPLAN conference on Systems, Programming, Languages and Applications: Software for Humanity (SPLASH) embraces all aspects of software construction, to make it the premier conference at the intersection of programming, languages, systems,
Categories: Incoming News

### Mark Jason Dominus: Addenda to recent articles 201607

Planet Haskell - Mon, 07/11/2016 - 11:39am

Here are some notes on posts from the last couple of months that I couldn't find better places for.

• I wrote a long article about tracking down a system bug. At some point I determined that the problem was related to Perl, and asked Frew Schmidt for advice. He wrote up the details of his own investigation, which pick up where mine ended. Check it out. I 100% endorse his lament about ltrace.

• There was a Hacker News discussion about that article. One participant asked a very pertinent question:

I read this, but seemed to skip over the part where he explains why this changed suddenly, when the behavior was documented?

What changed to make the perl become capable whereas previously it lacked the low port capability?

So far, we don't know! Frew told me recently that he thinks the TMPDIR-losing has been going on for months and that whatever precipitated my problem is something else.

• In my article on the Greek clock, I guessed a method for calculating the (approximate) maximum length of the day from the latitude: $$A = 360 \text{ min}\cdot(1-\cos L).$$

Sean Santos of UCAR points out that this is inaccurate close to the poles. For places like Philadelphia (40° latitude) it is pretty close, but it fails completely for locations north of the Arctic Circle. M. Santos advises instead:

$$A = 360 \text{ min}\cdot \frac{2}{\pi}\cdot \sin^{-1}(\tan L\cdot \tan\epsilon)$$

where ε is the axial tilt of the Earth, approximately 23.4°. Observe that when is above the Arctic Circle (or below the Antarctic) we have (because ) so the arcsine is undefined, and we get no answer.

Categories: Offsite Blogs

### Robert Harper: PCLSRING in Semantics

Planet Haskell - Mon, 07/11/2016 - 11:34am

PCLSRING is an operating system kernel design technique introduced in ITS for managing interruptions of long-running synchronous system calls.  It was mentioned in an infamous diatribe by Dick Gabriel, and is described in loving detail by Allen Bawden in an article for the ages.

Discussions of PCLSRING usually center on fundamental questions of systems design.  Is the ITS approach better than the Unix approach?   Should the whole issue be avoided by using asynchronous system calls, as in VMS?  And weren’t the good old days better than the bad new days anyway?

Let’s set those things aside for now and instead consider what it is, rather than what it’s for or whether it’s needed.  The crux of the matter is this.  Suppose you’re working with a system such as Unix that has synchronous system calls for file I/O, and you initiate a “large” read of n bytes into memory starting at address a.  It takes a while to perform the transfer, during which time the process making the call may be interrupted for any number of reasons.  The question is, what to do about the process state captured at the moment of the interrupt?

For various reasons it doesn’t make sense to snapshot the process while it is running inside the kernel.  One solution is to simply stop the read “in the middle” and arrange that, when the process resumes, it returns from the system call indicating that some m<=n bytes have been read.  You’re supposed to check that m=n yourself anyway, and restart the call if not.  (This is the Unix solution.)  It is all too easy to neglect the check, and the situation is made the worse because so few languages have sum types which would make it impossible to neglect the deficient return.

PCLSRING instead stops the system call in place, backs up the process PC to the system call, but with the parameters altered to read n-m bytes into location a+m, so that when the process resumes it simply makes a “fresh” system call to finish the read that was so rudely interrupted.  The one drawback, if it is one, is that your own parameters may get altered during the call, so you shouldn’t rely on them being anything in particular after it returns.  (This is all more easily visualized in assembly language, where the parameters are typically words that follow the system call itself in memory.)

While lecturing at this year’s OPLSS, it occurred to me that the dynamics of Modernized Algol in PFPL, which is given in Plotkin’s style, is essentially the same idea.  Consider the rule for executing an encapsulated command:

if mm’, then bnd(cmd(m);x.m”)bnd(cmd(m’);x.m”)

(I have suppressed the memory component of the state, which is altered as well.)  The expression cmd(m) encapsulates the command m.  The bnd command executes m and passes its result to another command, m”, via the variable x.  The above rule specifies that a step of execution of m results in a reconstruction of the entire bnd, albeit encapsulating m’ , the intermediate result, instead of m.  It’s exactly PCLSRING!  Think of m as the kernel code for the read, think of cmd as the system call, and think of the bnd as the sequential composition of commands in an imperative language.  The kernel only makes partial progress executing m before being interrupted, leaving m’ remaining to be executed to complete the call.  The “pc” is backed up to the bnd, albeit modified with m’ as the new “system call” to be executed on the next transition.

I just love this sort of thing!  The next time someone asks “what the hell is PCLSRING?”, you now have the option of explaining it in one line, without any mention of operating systems.  It’s all a matter of semantics.

Filed under: Programming, Research, Teaching Tagged: operating systems, pclsring, structural operational semantics
Categories: Offsite Blogs

### 2016 Autumn School on Computational Logic

General haskell list - Mon, 07/11/2016 - 10:46am
(Apologies if you receive multiple copies of this email. Please distribute to interested parties.) The 2016 Autumn School on Computational Logic will be held on October 16-17, 2016, in New York, affiliated to the 32nd International Conference on Logic Programming (ICLP'16). Researchers and PhD students are encouraged to attend. Student scholarships are available (Deadline for application: July 20) Association for Logic Programming 2016 Autumn School on Computational Logic http://iclp16school.webs.upv.es/ October 16-17, New York, USA (Affiliated to ICLP'16) Researchers interested in research in computational logic are invited to attend the 2016 Autumn School. The 2-day school is suited for those who wish to learn advanced topics in computational logic and logic programming. It will consist of four half-day tutorials on the following topics: 1. Constraint Logic Programming Lecturer: Roman Bartak, Charles Unive
Categories: Incoming News

### Cannot install any packages after upgrading to GHC8.0.1

haskell-cafe - Mon, 07/11/2016 - 8:49am
Hi, I update my GHC to 8.0.1 and failed to install any packages since then. If I use cabal, I got 'installed package info from too old version of Cabal (key field does not match id field)' for every package. If I use Setup.hs, I got 'Configuring Cabal-1.24.0.0... Setup.hs: ghc-pkg dump failed'. What should I do? Googling did not get me an answer. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
Categories: Offsite Discussion

### ANN: enchant-0.1.0.0

General haskell list - Mon, 07/11/2016 - 4:35am
Hello, I'm happy to announce the first release of enchant, binding for the Enchant library. https://hackage.haskell.org/package/enchant-0.1.0.0 https://github.com/kseo/enchant What is Enchant? (from http://www.abisource.com/projects/enchant/) On the surface, Enchant appears to be a generic spell checking library. You Thanks, Kwang Yul Seo _______________________________________________ Haskell mailing list Haskell< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell
Categories: Incoming News