From jerzy.karczmarczuk at unicaen.fr Fri Apr 1 02:24:49 2016 From: jerzy.karczmarczuk at unicaen.fr (Jerzy Karczmarczuk) Date: Fri, 1 Apr 2016 04:24:49 +0200 Subject: [Haskell-cafe] [Haskell] Postdoc ad: quantum-computing programming languages In-Reply-To: <56FD82C9.6020400@lanl.gov> References: <56FD82C9.6020400@lanl.gov> Message-ID: <56FDDBF1.9080802@unicaen.fr> Hello. Le 31/03/2016 22:04, Scott Pakin a ?crit : > My institution just bought a D-Wave 2X adiabatic quantum computer. > The problem is, no one really has a grasp on how to *program* an > adiabatic quantum computer. It's a totally different beast from the > gate-model quantum computers that most people imply when they talk > about quantum computing. I find all this a bit disturbing... Los Alamos buys an expensive device that nobody knows how to use?? Moreover, in circumstances where the doubts about the real performance of the D-Wave computer stii persist? Several physicists refuse to call this contraption a "quantum computer". The statements about their "qubits" in their public materials are not always serious, there is practically nothing about a genuine state superposition, no educated physicist will buy such pseudo-definition as "having simultaneously the values 0 and 1" (being the result of two currents flowing in opposite directions ; what about phase?). Their "white paper" about the map colouring shows a model which is more similar to a Hopfield (or similar) neural network, rather than a quantum computing device. The optimization is a natural application domain of such networks, but where are some more universal examples? Surely, there are quantum elements in it: superconducting niobium rings, Josephson junctions, etc. But, actually, even a plain transistor is a quantum device as well, and nobody dares to call it a "qubit". Their native code seems to be extremely far from quantum theory, as we know it. = But, if the device works, has some affinities with neural stuff and with Monte-Carlo techniques (annealing), perhaps a good playground for testing it would be a Go player? Jerzy Karczmarczuk From rustompmody at gmail.com Fri Apr 1 03:12:02 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Fri, 1 Apr 2016 08:42:02 +0530 Subject: [Haskell-cafe] introspection -- towards type algebra Message-ID: I am looking for how far algebra on types in the manner of "set theory as an algebra" ? is possible. So for example in set theory one can compute for sets S, T S?T, S?T, S-T etc Is something similar possible for types? Say I have data Primary = Red|Green|Blue data Othercolors = Violet|Indigo|Yellow|Orange I want something like Rainbow = Primary ? Othercolors Equivalently if Rainbow and Primary had been defined, how to get/compute Rainbow - Primary? ------------------------- I thought the first-class types in Idris would be a good bet to try out at least a trivial prototype. Seems not... So asking here. Clearly and obviously one can use haskell to implement any language. My question is what/which are the introspective libraries/features of modern haskell that make this easy and lightweight. Thanks Rusi ? Yeah the term 'type algebra' may be taken in the sense of algebraic data types Cant think of a better one -------------- next part -------------- An HTML attachment was scrubbed... URL: From dedgrant at gmail.com Fri Apr 1 03:52:10 2016 From: dedgrant at gmail.com (Darren Grant) Date: Thu, 31 Mar 2016 20:52:10 -0700 Subject: [Haskell-cafe] [Haskell] Postdoc ad: quantum-computing programming languages In-Reply-To: <56FDDBF1.9080802@unicaen.fr> References: <56FD82C9.6020400@lanl.gov> <56FDDBF1.9080802@unicaen.fr> Message-ID: Research interest is in the way such a machine might work, rather than the possible (unlikely) affront to ontology. Demanding a priori documentation is a bit disingenuous as the land is undiscovered. Cheers, Darren On Mar 31, 2016 19:24, "Jerzy Karczmarczuk" wrote: > Hello. > > Le 31/03/2016 22:04, Scott Pakin a ?crit : > >> My institution just bought a D-Wave 2X adiabatic quantum computer. >> The problem is, no one really has a grasp on how to *program* an >> adiabatic quantum computer. It's a totally different beast from the >> gate-model quantum computers that most people imply when they talk >> about quantum computing. >> > I find all this a bit disturbing... > Los Alamos buys an expensive device that nobody knows how to use?? > > Moreover, in circumstances where the doubts about the real performance of > the D-Wave computer stii persist? > > Several physicists refuse to call this contraption a "quantum computer". > The statements about their "qubits" in their public materials are not > always serious, there is practically nothing about a genuine state > superposition, no educated physicist will buy such pseudo-definition as > "having simultaneously the values 0 and 1" (being the result of two > currents flowing in opposite directions ; what about phase?). > > Their "white paper" about the map colouring shows a model which is more > similar to a Hopfield (or similar) neural network, rather than a quantum > computing device. The optimization is a natural application domain of such > networks, but where are some more universal examples? > > Surely, there are quantum elements in it: superconducting niobium rings, > Josephson junctions, etc. But, actually, even a plain transistor is a > quantum device as well, and nobody dares to call it a "qubit". Their native > code seems to be extremely far from quantum theory, as we know it. > > = > But, if the device works, has some affinities with neural stuff and with > Monte-Carlo techniques (annealing), perhaps a good playground for testing > it would be a Go player? > > Jerzy Karczmarczuk > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerzy.karczmarczuk at unicaen.fr Fri Apr 1 09:36:48 2016 From: jerzy.karczmarczuk at unicaen.fr (Jerzy Karczmarczuk) Date: Fri, 1 Apr 2016 11:36:48 +0200 Subject: [Haskell-cafe] [Haskell] Postdoc ad: quantum-computing programming languages In-Reply-To: References: <56FD82C9.6020400@lanl.gov> <56FDDBF1.9080802@unicaen.fr> Message-ID: <56FE4130.7010303@unicaen.fr> Darren Grant decided to become the lawyer for D-Wave...: > > Research interest is in the way such a machine might work, rather than > the possible (unlikely) affront to ontology. > > Demanding a priori documentation is a bit disingenuous as the land is > undiscovered. > Dear Darren, 1. I did not speak about an "affront to ontology" (the phrase which I don't understand). I said something about their abusive terminology, according to some dozens of texts I read. Several competent people raised doubts about the nature of this device, if you are one of them (there is one D.G., physicist in Alberta), point me to *serious* texts which defend the D-W, you should find them, sincerely. I am NOT accusing them of cheating with physics, or selling rubbish, come on, but Vazirani criticised them, Aaronson as well, the Science article in 2014 also. 2. "...the way such a machine might work" is a technological issue, not JUST a "research interest". They SELL it. "A priori documentation"? "Land is undiscovered"?? What are you talking about? The story has 10 years. Google tested some optimization stuff with the machine in 2009. Some Ising model simulations took place in 2013, and *apparently* the speedup obtained had nothing to do with the "standard hype" of quantum computation. The whole issue of quantum entanglement in their device, is one big mess. 3. I will comment privately your public use of the word "disingenuous", when I learn what can you SAY about the domain of quantum computations. My competence is rather weak, but I taught it a bit. Regards. Jerzy Karczmarczuk From anakreonmejdi at gmail.com Fri Apr 1 11:17:12 2016 From: anakreonmejdi at gmail.com (Anakreontas) Date: Fri, 1 Apr 2016 04:17:12 -0700 (PDT) Subject: [Haskell-cafe] Deriving Eq and Show instances for testing In-Reply-To: <56FD4740.2060603@gmail.com> References: <61344674-9551-4bac-ae4d-37321d3a2ab0@googlegroups.com> <56FD4740.2060603@gmail.com> Message-ID: <127fcfe0-be1f-4ab2-b231-4254f0fe9928@googlegroups.com> Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From P.Achten at cs.ru.nl Fri Apr 1 15:06:31 2016 From: P.Achten at cs.ru.nl (Peter Achten) Date: Fri, 1 Apr 2016 17:06:31 +0200 Subject: [Haskell-cafe] [TFP 2016] Final call for papers Message-ID: <56FE8E77.8010101@cs.ru.nl> ----------------------------- C A L L F O R P A P E R S ----------------------------- ======== TFP 2016 =========== 17th Symposium on Trends in Functional Programming June 8-10, 2016 University of Maryland, College Park Near Washington, DC http://tfp2016.org/ The symposium on Trends in Functional Programming (TFP) is an international forum for researchers with interests in all aspects of functional programming, taking a broad view of current and future trends in the area. It aspires to be a lively environment for presenting the latest research results, and other contributions (see below). Authors of draft papers will be invited to submit revised papers based on the feedback receive at the symposium. A post-symposium refereeing process will then select a subset of these articles for formal publication. TFP 2016 will be the main event of a pair of functional programming events. TFP 2016 will be accompanied by the International Workshop on Trends in Functional Programming in Education (TFPIE), which will take place on June 7nd. == INVITED SPEAKERS == TFP 2016 is pleased to announce keynote talks by the following two invited speakers: * Ronald Garcia, University of British Columbia * Steve Zdancewic, University of Pennsylvania == HISTORY == The TFP symposium is the heir of the successful series of Scottish Functional Programming Workshops. Previous TFP symposia were held in * Edinburgh (Scotland) in 2003; * Munich (Germany) in 2004; * Tallinn (Estonia) in 2005; * Nottingham (UK) in 2006; * New York (USA) in 2007; * Nijmegen (The Netherlands) in 2008; * Komarno (Slovakia) in 2009; * Oklahoma (USA) in 2010; * Madrid (Spain) in 2011; * St. Andrews (UK) in 2012; * Provo (Utah, USA) in 2013; * Soesterberg (The Netherlands) in 2014; * and Inria Sophia-Antipolis (France) in 2015. For further general information about TFP please see the TFP homepage. (http://www.tifp.org/). == SCOPE == The symposium recognizes that new trends may arise through various routes. As part of the Symposium's focus on trends we therefore identify the following five article categories. High-quality articles are solicited in any of these categories: Research Articles: leading-edge, previously unpublished research work Position Articles: on what new trends should or should not be Project Articles: descriptions of recently started new projects Evaluation Articles: what lessons can be drawn from a finished project Overview Articles: summarizing work with respect to a trendy subject Articles must be original and not simultaneously submitted for publication to any other forum. They may consider any aspect of functional programming: theoretical, implementation-oriented, or experience-oriented. Applications of functional programming techniques to other languages are also within the scope of the symposium. Topics suitable for the symposium include, but are not limited to: Functional programming and multicore/manycore computing Functional programming in the cloud High performance functional computing Extra-functional (behavioural) properties of functional programs Dependently typed functional programming Validation and verification of functional programs Debugging and profiling for functional languages Functional programming in different application areas: security, mobility, telecommunications applications, embedded systems, global computing, grids, etc. Interoperability with imperative programming languages Novel memory management techniques Program analysis and transformation techniques Empirical performance studies Abstract/virtual machines and compilers for functional languages (Embedded) domain specific languages New implementation strategies Any new emerging trend in the functional programming area If you are in doubt on whether your article is within the scope of TFP, please contact the TFP 2016 program chair, David Van Horn. == BEST PAPER AWARDS == To reward excellent contributions, TFP awards a prize for the best paper accepted for the formal proceedings. TFP traditionally pays special attention to research students, acknowledging that students are almost by definition part of new subject trends. A student paper is one for which the authors state that the paper is mainly the work of students, the students are listed as first authors, and a student would present the paper. A prize for the best student paper is awarded each year. In both cases, it is the PC of TFP that awards the prize. In case the best paper happens to be a student paper, that paper will then receive both prizes. == SPONSORS == TFP is financially supported by CyberPoint, Galois, Trail of Bits, and the University of Maryland Computer Science Department. == PAPER SUBMISSIONS == Acceptance of articles for presentation at the symposium is based on a lightweight peer review process of extended abstracts (4 to 10 pages in length) or full papers (20 pages). The submission must clearly indicate which category it belongs to: research, position, project, evaluation, or overview paper. It should also indicate which authors are research students, and whether the main author(s) are students. A draft paper for which ALL authors are students will receive additional feedback by one of the PC members shortly after the symposium has taken place. We use EasyChair for the refereeing process. Papers must be submitted at: https://easychair.org/conferences/?conf=tfp2016 Papers must be written in English, and written using the LNCS style. For more information about formatting please consult the Springer LNCS web site: http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0 == IMPORTANT DATES == Submission of draft papers: April 8, 2016 Notification: April 15, 2016 Registration: May 13, 2016 TFP Symposium: June 8-10, 2016 Student papers feedback: June 14, 2016 Submission for formal review: July 14, 2016 Notification of acceptance: September 14, 2016 Camera ready paper: October 14, 2016 == PROGRAM COMMITTEE == Amal Ahmed Northeastern University (US) Nada Amin ?cole Polytechnique F?d?rale de Lausanne (CH) Kenichi Asai Ochanomizu University (JP) Malgorzata Biernacka University of Wroclaw (PL) Laura Castro University of A Coru?a (ES) Ravi Chugh University of Chicago (US) Silvia Ghilezan University of Novi Sad (SR) Clemens Grelck University of Amsterdam (NL) John Hughes Chalmers University of Technology (SE) Suresh Jagannathan Purdue University (US) Pieter Koopman Radboud University Nijmegen (NL) Geoffrey Mainland Drexel University (US) Chris Martens University of California, Santa Cruz (US) Jay McCarthy University of Massachusetts, Lowell (US) Heather Miller ?cole Polytechnique F?d?rale de Lausanne (CH) Manuel Serrano INRIA, Sophia-Antipolis (FR) Scott Smith Johns Hopkins University (US) ?ric Tanter University of Chile (CL) David Van Horn (Chair) University of Maryland (US) Niki Vazou University of California, San Diego (US) Stephanie Weirich University of Pennsylvania (US) From kei at lanl.gov Fri Apr 1 15:14:12 2016 From: kei at lanl.gov (Kei Davis) Date: Fri, 1 Apr 2016 09:14:12 -0600 Subject: [Haskell-cafe] Haskell hacking internships at LANL (Fall 2016, undergraduate) In-Reply-To: <56FE8FEE.6050807@lanl.gov> References: <56FE8FEE.6050807@lanl.gov> Message-ID: <56FE9044.5090806@lanl.gov> We have an ongoing project developing an auto-parallelizing pure functional language implementation using GHC as the front end to dump Core or STG (much like Intel's approach here http://www.leafpetersen.com/leaf/publications/hs2013/hrc-paper.pdf). If you are a United States citizen or permanent resident alien studying computer science or mathematics at the undergraduate level with strong interests in Haskell programming, compiler/runtime development, and pursuing a fall semester (2016) internship at Los Alamos National Laboratory this could be for you. We don't expect applicants to necessarily already be highly accomplished Haskell programmers--such an internship is expected to be a combination of (further) developing your programming/Haskell skills and putting them to good use. If you're already a strong C hacker we could use that too. The application deadline is May 31, 2016. It's a bit of a process so don't leave inquiries until the last day. Email me if interested in more information, and feel free to pass this along. -- Kei Davis kei at lanl.gov Applied Computer Science Group CCS-7, Mail Stop B287 Los Alamos National Laboratory Los Alamos, NM 87545, U.S.A. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jm at memorici.de Fri Apr 1 16:57:43 2016 From: jm at memorici.de (Jonn Mostovoy) Date: Fri, 1 Apr 2016 18:57:43 +0200 Subject: [Haskell-cafe] Testing Msgpack system In-Reply-To: References: Message-ID: Dear David, thank you very much! Your answers were extremely insightful. To adapt this approach we will need to refactor our types quite a bit, but that will be well worth it. ? Kindest regards, jm On Mar 31, 2016 10:10 AM, "David Turner" wrote: > Hi Jonn, > > I work on a similar-sounding system. We have arranged things so that each > node is a pure state machine, with outputs that are a pure function of its > inputs, with separate (and simple, obviously correct) machinery for > connecting these state machines over the network. This makes it rather > simple to run a bunch of these state machines in a test harness that > simulates all sorts of network nastiness (disconnections, dropped or > reordered messages, delays, corruption etc.) on a single thread. > > One trick that proved useful was to feed in the current time as an > explicit input message. This makes it possible to test things like timeouts > without having to actually wait for the time to pass, which speeds things > up immensely. We also make use of ContT somewhere in the tests to > interleave processing and assertions, and to define a 'hypothetically' > operator that lets a test run a sequence of actions and then backtrack. > > I think this idea was inspired by > https://github.com/NicolasT/paxos/blob/master/bin/synod.hs, at least the > network nastiness simulator thing. He uses threads for that demo but the > nodes' behaviour itself is pure: > https://github.com/NicolasT/paxos/blob/master/src/Network/Paxos/Synod/Proposer.hs for > example. > > We also have proved certain key properties of the network are implied by > certain local invariants, which reduces the testing problem down to one of > checking properties on each node separately. This was time consuming, but > highlighted certain important corner cases that it's unlikely we would have > found by random testing. > > If you're interested in Byzantine behaviour (the 'evil node' test) then > you may enjoy reading James Mickens' article on the subject: > https://www.usenix.org/publications/login-logout/may-2013/saddest-moment > > Hope that helps, > > David > > PS a double apology: firstly for the double message (my first attempt was > sent from the wrong address) and secondly for spelling your name wrong in > that message! > > On 31 March 2016 at 00:41, Jonn Mostovoy wrote: > >> Dear friends, >> >> we have a distributed system written in Haskell, consisting of three >> types of nodes with dozen of instances of each of two types and a >> central node of the third type. >> >> Each node is started by executing a binary which sets up acid-state >> persistence layer and sockets over which msgpack messages are sent >> around. >> >> It is trivial to write low level functionality quickcheck test suites, >> which test properties of functions. >> >> We would like, however, to have a quickcheck-esque suite which sets up >> the network, then gets it to an arbitrary valid state (sending correct >> messages between nodes), then rigorously testing it for three >> high-level properties: >> >> 1. Chaos monkey test (disable random node, see if certain invariants >> hold); >> 2. Evil node test (make several nodes work against the system, see if >> certain properties hold); >> 3. Rigorous testing of network-wide invariants, if all the nodes >> operate correctly. >> >> The problem we're facing is the following ? if we want to inspect >> state of nodes in Haskell-land, we have to write a huge machinery >> which emulates every launch of node via thread. There will be bugs in >> this machinery, so we won't be able to get quality testing information >> before we fix those; if we want to run things as processes, then the >> best thing we can do is to inspect either acid-state dbs of each node >> (it poses resource locking problems and forces us to dump the state on >> every change, which is undesirable), or make an observer node, which >> dumps the consensus as Text and then parsing the data into Haskell >> terms, making decisions about the required properties based on that >> (so far, it feels like the best option). >> >> Am I missing something? How is something like this achieved in >> culture? How would you approach such a problem? >> >> Links to source files of test suites which do something similar are >> highly appreciated. >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gracjanpolak at gmail.com Fri Apr 1 18:37:24 2016 From: gracjanpolak at gmail.com (Gracjan Polak) Date: Fri, 1 Apr 2016 20:37:24 +0200 Subject: [Haskell-cafe] Month in Haskell Mode March 2016 Message-ID: Welcome Haskell Mode users, Haskell Mode progress report for March 2016. For previous issue see February 2016 . Reddit discussion . What is Haskell Mode? Haskell Mode is an umbrella project for multiple Emacs tools for efficient Haskell development. Haskell Mode is an open source project developed by a group of volunteers constantly looking for contributions. For more information how to help see https://github.com/haskell/haskell-mode. Important developments We have noticed that haskell-mode project on Github is steadily growing in popularity and that is clearly visible on historical growth graph: [image: History of stars on github leading to the number 700] So star us on Github, follow us on Twitter: @HaskellMode . Issues closed in February - Implement REPL RET behaviour on previous prompts #30 - Disable Indentation #90 - Del/Backspace do not delete text selection in literate mode outside bird lines #379 - haskell-mode-jump-to-def-or-tag Requires a running session #650 - haskell-indentation-mode does not bind DEL #721 - REPL does not work properly until load or reload file second time #765 - Create a gifcast for interactive-haskell-mode startup #824 - Getting Stack overflow in regexp matcher error in Haskell module having more than 1500loc #830 - C-u C-c C-t doesn't add type signature #900 - Invoke hasktags more directly #964 - Find a professional template for web presence #1117 - Indenting data types seems broken and not configurable #1125 - Syntax propertize could mark layout blocks #1164 - Support non-interactive completions #1171 - Remove haskell-doc-prelude-types from haskell-doc.el #1179 - Deprecate haskell-mode-contextual-space #1182 - Paredit M-s no longer works after upgrade to 13.18 #1183 - Extend non-interactive completions for identifiers from TAGS #1184 - Syntax highlighting is broken for list comprehensions #1185 - haskell-mode and delete-trailing-whitespace delete content of buffer on save #1188 - Indentation is broken for quasiquotation with quote symbols #1189 - Error: (void-function haskell--rx-let) #1209 - Check if haskell-mode-autoloads.el really loads #1210 - haskell-ident-pos-at-point does not work for operators #1213 - REPL often hangs inside :{ and :} #1221 - haskell-mode-contextual-space binding on the wiki is preventing space insertion #1222 - Font-lock misidentifying valid non-TH haskell as quasiquote #1223 - Regression in indentation logic #1232 - Fix inferior-haskell-send-decl-post-filter #1240 - Error message when hitting space bar #1242 Pull requests merged in February - Add haskell-interactive-copy-to-prompt. #457 - Remove suggested imports completely #1121 - Stylish haskell after save #1137 - Add a test for indentation broken on a quasiquote #1190 - Remove haskell-mode-contextual-space #1191 - Add chapter about spell checking #1192 - Make haskell-indent-region do nothing #1193 - Prevent automatic haskell-doc-mode actions when point in string or comment #1195 - Treat insides of quasiquotes as strings #1196 - Add comma list test for indentation #1198 - Add c2hs mode #1199 - Change a couple hook properties #1201 - Fix some warnings #1202 - Small improvements of completion functions #1203 - Invoke hasktags more directly #1204 - Few doc improvements and a bit of refactoring #1205 - Keep window position when spellchecking #1207 - Improve fonts in manual #1208 - Makefile dependency tracking improvements #1211 - C2hs fixes #1212 - Guard against tabs in elisp files #1214 - Return removed names for backward compatibility #1215 - Handle operators in haskell-ident-pos-at-point too #1224 - Move haskell-interactive-prompt-state related definitions to haskell-utils.el #1226 - Extend static completions with candidates from tags table #1228 - Update completion section #1230 - Small docs improvements #1233 - Remove unused indent-region from menu #1236 - Be more strict about quasi quoter names #1239 - Use plain syntax in inferior-haskell-send-decl-post-filter #1241 Contributors active in February Arthur Fayzrakhmanov (????? ????????????), Artyom, Fice T, Gracjan Polak, Sergey Vinokurov Contributing Haskell Mode needs volunteers like any other open source project. For more information see: https://github.com/haskell/haskell-mode/wiki Also drop by our IRC channel: #haskell-emacs at irc.freenode.net. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Sun Apr 3 03:05:19 2016 From: david.feuer at gmail.com (David Feuer) Date: Sat, 2 Apr 2016 23:05:19 -0400 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists Message-ID: I ran into a fun question today: http://stackoverflow.com/q/36342967/1477667 Specifically, it asks how to find all ways to interleave lists so that the order of elements within each list is preserved. The most efficient way I found is copied below. It's nicely lazy, and avoids left-nested appends. Unfortunately, it's pretty seriously ugly. Does anyone have any idea of a way to do this that's both efficient and elegant? {-# LANGUAGE BangPatterns #-} import Data.Monoid import Data.Foldable (toList) import Data.Sequence (Seq, (|>)) -- Find all ways to interleave two lists interleave2 :: [a] -> [a] -> [[a]] interleave2 xs ys = interleave2' mempty xs ys [] -- Find all ways to interleave two lists, adding the -- given prefix to each result and continuing with -- a given list to append interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] interleave2' !prefix xs ys rest = (toList prefix ++ xs ++ ys) : interleave2'' prefix xs ys rest -- Find all ways to interleave two lists except for -- the trivial case of just appending them. Glom -- the results onto the given list. interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] interleave2'' !prefix [] _ = id interleave2'' !prefix _ [] = id interleave2'' !prefix xs@(x : xs') ys@(y : ys') = interleave2' (prefix |> y) xs ys' . interleave2'' (prefix |> x) xs' ys -- What the question poser wanted; I don't *think* there's -- anything terribly interesting to do here. interleavings :: [[a]] -> [[a]] interleavings = foldr (concatMap . interleave2) [[]] Thanks, David From arseniy.alekseyev at gmail.com Sun Apr 3 04:16:24 2016 From: arseniy.alekseyev at gmail.com (Arseniy Alekseyev) Date: Sun, 3 Apr 2016 05:16:24 +0100 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: I measure the following naive solution of interleave2 beating yours in performance: i2 [] ys = [ys] i2 xs [] = [xs] i2 (x : xs) (y : ys) = fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) The program I'm benchmarking is: main = print $ sum $ map sum $ interleavings [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] On 3 April 2016 at 04:05, David Feuer wrote: > I ran into a fun question today: > http://stackoverflow.com/q/36342967/1477667 > > Specifically, it asks how to find all ways to interleave lists so that > the order of elements within each list is preserved. The most > efficient way I found is copied below. It's nicely lazy, and avoids > left-nested appends. Unfortunately, it's pretty seriously ugly. Does > anyone have any idea of a way to do this that's both efficient and > elegant? > > {-# LANGUAGE BangPatterns #-} > import Data.Monoid > import Data.Foldable (toList) > import Data.Sequence (Seq, (|>)) > > -- Find all ways to interleave two lists > interleave2 :: [a] -> [a] -> [[a]] > interleave2 xs ys = interleave2' mempty xs ys [] > > -- Find all ways to interleave two lists, adding the > -- given prefix to each result and continuing with > -- a given list to append > interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] > interleave2' !prefix xs ys rest = > (toList prefix ++ xs ++ ys) > : interleave2'' prefix xs ys rest > > -- Find all ways to interleave two lists except for > -- the trivial case of just appending them. Glom > -- the results onto the given list. > interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] > interleave2'' !prefix [] _ = id > interleave2'' !prefix _ [] = id > interleave2'' !prefix xs@(x : xs') ys@(y : ys') = > interleave2' (prefix |> y) xs ys' . > interleave2'' (prefix |> x) xs' ys > > -- What the question poser wanted; I don't *think* there's > -- anything terribly interesting to do here. > interleavings :: [[a]] -> [[a]] > interleavings = foldr (concatMap . interleave2) [[]] > > > Thanks, > David > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Sun Apr 3 04:38:09 2016 From: david.feuer at gmail.com (David Feuer) Date: Sun, 3 Apr 2016 00:38:09 -0400 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: Your lists are very short. Pump them up to thousands of elements each and you will see a problem emerge in the naive solution. On Sun, Apr 3, 2016 at 12:16 AM, Arseniy Alekseyev wrote: > I measure the following naive solution of interleave2 beating yours in > performance: > > i2 [] ys = [ys] > i2 xs [] = [xs] > i2 (x : xs) (y : ys) = > fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) > > The program I'm benchmarking is: > > main = print $ sum $ map sum $ interleavings > [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] > > > > On 3 April 2016 at 04:05, David Feuer wrote: >> >> I ran into a fun question today: >> http://stackoverflow.com/q/36342967/1477667 >> >> Specifically, it asks how to find all ways to interleave lists so that >> the order of elements within each list is preserved. The most >> efficient way I found is copied below. It's nicely lazy, and avoids >> left-nested appends. Unfortunately, it's pretty seriously ugly. Does >> anyone have any idea of a way to do this that's both efficient and >> elegant? >> >> {-# LANGUAGE BangPatterns #-} >> import Data.Monoid >> import Data.Foldable (toList) >> import Data.Sequence (Seq, (|>)) >> >> -- Find all ways to interleave two lists >> interleave2 :: [a] -> [a] -> [[a]] >> interleave2 xs ys = interleave2' mempty xs ys [] >> >> -- Find all ways to interleave two lists, adding the >> -- given prefix to each result and continuing with >> -- a given list to append >> interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >> interleave2' !prefix xs ys rest = >> (toList prefix ++ xs ++ ys) >> : interleave2'' prefix xs ys rest >> >> -- Find all ways to interleave two lists except for >> -- the trivial case of just appending them. Glom >> -- the results onto the given list. >> interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >> interleave2'' !prefix [] _ = id >> interleave2'' !prefix _ [] = id >> interleave2'' !prefix xs@(x : xs') ys@(y : ys') = >> interleave2' (prefix |> y) xs ys' . >> interleave2'' (prefix |> x) xs' ys >> >> -- What the question poser wanted; I don't *think* there's >> -- anything terribly interesting to do here. >> interleavings :: [[a]] -> [[a]] >> interleavings = foldr (concatMap . interleave2) [[]] >> >> >> Thanks, >> David >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > From arseniy.alekseyev at gmail.com Sun Apr 3 04:39:29 2016 From: arseniy.alekseyev at gmail.com (Arseniy Alekseyev) Date: Sun, 3 Apr 2016 05:39:29 +0100 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: Um, the result is exponential in size. A problem will emerge in any solution. :) On 3 April 2016 at 05:38, David Feuer wrote: > Your lists are very short. Pump them up to thousands of elements each > and you will see a problem emerge in the naive solution. > > On Sun, Apr 3, 2016 at 12:16 AM, Arseniy Alekseyev > wrote: > > I measure the following naive solution of interleave2 beating yours in > > performance: > > > > i2 [] ys = [ys] > > i2 xs [] = [xs] > > i2 (x : xs) (y : ys) = > > fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) > > > > The program I'm benchmarking is: > > > > main = print $ sum $ map sum $ interleavings > > [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] > > > > > > > > On 3 April 2016 at 04:05, David Feuer wrote: > >> > >> I ran into a fun question today: > >> http://stackoverflow.com/q/36342967/1477667 > >> > >> Specifically, it asks how to find all ways to interleave lists so that > >> the order of elements within each list is preserved. The most > >> efficient way I found is copied below. It's nicely lazy, and avoids > >> left-nested appends. Unfortunately, it's pretty seriously ugly. Does > >> anyone have any idea of a way to do this that's both efficient and > >> elegant? > >> > >> {-# LANGUAGE BangPatterns #-} > >> import Data.Monoid > >> import Data.Foldable (toList) > >> import Data.Sequence (Seq, (|>)) > >> > >> -- Find all ways to interleave two lists > >> interleave2 :: [a] -> [a] -> [[a]] > >> interleave2 xs ys = interleave2' mempty xs ys [] > >> > >> -- Find all ways to interleave two lists, adding the > >> -- given prefix to each result and continuing with > >> -- a given list to append > >> interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] > >> interleave2' !prefix xs ys rest = > >> (toList prefix ++ xs ++ ys) > >> : interleave2'' prefix xs ys rest > >> > >> -- Find all ways to interleave two lists except for > >> -- the trivial case of just appending them. Glom > >> -- the results onto the given list. > >> interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] > >> interleave2'' !prefix [] _ = id > >> interleave2'' !prefix _ [] = id > >> interleave2'' !prefix xs@(x : xs') ys@(y : ys') = > >> interleave2' (prefix |> y) xs ys' . > >> interleave2'' (prefix |> x) xs' ys > >> > >> -- What the question poser wanted; I don't *think* there's > >> -- anything terribly interesting to do here. > >> interleavings :: [[a]] -> [[a]] > >> interleavings = foldr (concatMap . interleave2) [[]] > >> > >> > >> Thanks, > >> David > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Sun Apr 3 04:41:45 2016 From: david.feuer at gmail.com (David Feuer) Date: Sun, 3 Apr 2016 00:41:45 -0400 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: Of course, but something like take k . (!! m) will cut it down nicely. On Sun, Apr 3, 2016 at 12:39 AM, Arseniy Alekseyev wrote: > Um, the result is exponential in size. A problem will emerge in any > solution. :) > > On 3 April 2016 at 05:38, David Feuer wrote: >> >> Your lists are very short. Pump them up to thousands of elements each >> and you will see a problem emerge in the naive solution. >> >> On Sun, Apr 3, 2016 at 12:16 AM, Arseniy Alekseyev >> wrote: >> > I measure the following naive solution of interleave2 beating yours in >> > performance: >> > >> > i2 [] ys = [ys] >> > i2 xs [] = [xs] >> > i2 (x : xs) (y : ys) = >> > fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) >> > >> > The program I'm benchmarking is: >> > >> > main = print $ sum $ map sum $ interleavings >> > [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] >> > >> > >> > >> > On 3 April 2016 at 04:05, David Feuer wrote: >> >> >> >> I ran into a fun question today: >> >> http://stackoverflow.com/q/36342967/1477667 >> >> >> >> Specifically, it asks how to find all ways to interleave lists so that >> >> the order of elements within each list is preserved. The most >> >> efficient way I found is copied below. It's nicely lazy, and avoids >> >> left-nested appends. Unfortunately, it's pretty seriously ugly. Does >> >> anyone have any idea of a way to do this that's both efficient and >> >> elegant? >> >> >> >> {-# LANGUAGE BangPatterns #-} >> >> import Data.Monoid >> >> import Data.Foldable (toList) >> >> import Data.Sequence (Seq, (|>)) >> >> >> >> -- Find all ways to interleave two lists >> >> interleave2 :: [a] -> [a] -> [[a]] >> >> interleave2 xs ys = interleave2' mempty xs ys [] >> >> >> >> -- Find all ways to interleave two lists, adding the >> >> -- given prefix to each result and continuing with >> >> -- a given list to append >> >> interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >> >> interleave2' !prefix xs ys rest = >> >> (toList prefix ++ xs ++ ys) >> >> : interleave2'' prefix xs ys rest >> >> >> >> -- Find all ways to interleave two lists except for >> >> -- the trivial case of just appending them. Glom >> >> -- the results onto the given list. >> >> interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >> >> interleave2'' !prefix [] _ = id >> >> interleave2'' !prefix _ [] = id >> >> interleave2'' !prefix xs@(x : xs') ys@(y : ys') = >> >> interleave2' (prefix |> y) xs ys' . >> >> interleave2'' (prefix |> x) xs' ys >> >> >> >> -- What the question poser wanted; I don't *think* there's >> >> -- anything terribly interesting to do here. >> >> interleavings :: [[a]] -> [[a]] >> >> interleavings = foldr (concatMap . interleave2) [[]] >> >> >> >> >> >> Thanks, >> >> David >> >> _______________________________________________ >> >> Haskell-Cafe mailing list >> >> Haskell-Cafe at haskell.org >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > >> > > > From arseniy.alekseyev at gmail.com Sun Apr 3 05:04:00 2016 From: arseniy.alekseyev at gmail.com (Arseniy Alekseyev) Date: Sun, 3 Apr 2016 06:04:00 +0100 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: I see! At this point I'd say that you probably have the wrong type: there are ways to produce n'th interleaving much faster, but let's continue optimizing for the hell of it! i2 :: ([a] -> [b]) -> [a] -> [a] -> [[b]] -> [[b]] i2 f [] ys = (f ys :) i2 f xs [] = (f xs :) i2 f (x : xs) (y : ys) = i2 (f . (x :)) xs (y : ys) . i2 (f . (y :)) (x : xs) ys interleave2 xs ys = i2 id xs ys [] Seems faster than your original solution on examples I tried it on and it has fewer characters. :) On 3 April 2016 at 05:41, David Feuer wrote: > Of course, but something like take k . (!! m) will cut it down nicely. > > On Sun, Apr 3, 2016 at 12:39 AM, Arseniy Alekseyev > wrote: > > Um, the result is exponential in size. A problem will emerge in any > > solution. :) > > > > On 3 April 2016 at 05:38, David Feuer wrote: > >> > >> Your lists are very short. Pump them up to thousands of elements each > >> and you will see a problem emerge in the naive solution. > >> > >> On Sun, Apr 3, 2016 at 12:16 AM, Arseniy Alekseyev > >> wrote: > >> > I measure the following naive solution of interleave2 beating yours in > >> > performance: > >> > > >> > i2 [] ys = [ys] > >> > i2 xs [] = [xs] > >> > i2 (x : xs) (y : ys) = > >> > fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) > >> > > >> > The program I'm benchmarking is: > >> > > >> > main = print $ sum $ map sum $ interleavings > >> > [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] > >> > > >> > > >> > > >> > On 3 April 2016 at 04:05, David Feuer wrote: > >> >> > >> >> I ran into a fun question today: > >> >> http://stackoverflow.com/q/36342967/1477667 > >> >> > >> >> Specifically, it asks how to find all ways to interleave lists so > that > >> >> the order of elements within each list is preserved. The most > >> >> efficient way I found is copied below. It's nicely lazy, and avoids > >> >> left-nested appends. Unfortunately, it's pretty seriously ugly. Does > >> >> anyone have any idea of a way to do this that's both efficient and > >> >> elegant? > >> >> > >> >> {-# LANGUAGE BangPatterns #-} > >> >> import Data.Monoid > >> >> import Data.Foldable (toList) > >> >> import Data.Sequence (Seq, (|>)) > >> >> > >> >> -- Find all ways to interleave two lists > >> >> interleave2 :: [a] -> [a] -> [[a]] > >> >> interleave2 xs ys = interleave2' mempty xs ys [] > >> >> > >> >> -- Find all ways to interleave two lists, adding the > >> >> -- given prefix to each result and continuing with > >> >> -- a given list to append > >> >> interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] > >> >> interleave2' !prefix xs ys rest = > >> >> (toList prefix ++ xs ++ ys) > >> >> : interleave2'' prefix xs ys rest > >> >> > >> >> -- Find all ways to interleave two lists except for > >> >> -- the trivial case of just appending them. Glom > >> >> -- the results onto the given list. > >> >> interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] > >> >> interleave2'' !prefix [] _ = id > >> >> interleave2'' !prefix _ [] = id > >> >> interleave2'' !prefix xs@(x : xs') ys@(y : ys') = > >> >> interleave2' (prefix |> y) xs ys' . > >> >> interleave2'' (prefix |> x) xs' ys > >> >> > >> >> -- What the question poser wanted; I don't *think* there's > >> >> -- anything terribly interesting to do here. > >> >> interleavings :: [[a]] -> [[a]] > >> >> interleavings = foldr (concatMap . interleave2) [[]] > >> >> > >> >> > >> >> Thanks, > >> >> David > >> >> _______________________________________________ > >> >> Haskell-Cafe mailing list > >> >> Haskell-Cafe at haskell.org > >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> > > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Sun Apr 3 05:14:54 2016 From: david.feuer at gmail.com (David Feuer) Date: Sun, 3 Apr 2016 01:14:54 -0400 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: I choose the `force (map head)` attack. On Apr 3, 2016 1:04 AM, "Arseniy Alekseyev" wrote: > I see! At this point I'd say that you probably have the wrong type: there > are ways to produce n'th interleaving much faster, but let's continue > optimizing for the hell of it! > > i2 :: ([a] -> [b]) -> [a] -> [a] -> [[b]] -> [[b]] > i2 f [] ys = (f ys :) > i2 f xs [] = (f xs :) > i2 f (x : xs) (y : ys) = > i2 (f . (x :)) xs (y : ys) . i2 (f . (y :)) (x : xs) ys > > interleave2 xs ys = i2 id xs ys [] > > Seems faster than your original solution on examples I tried it on and it > has fewer characters. :) > > On 3 April 2016 at 05:41, David Feuer wrote: > >> Of course, but something like take k . (!! m) will cut it down nicely. >> >> On Sun, Apr 3, 2016 at 12:39 AM, Arseniy Alekseyev >> wrote: >> > Um, the result is exponential in size. A problem will emerge in any >> > solution. :) >> > >> > On 3 April 2016 at 05:38, David Feuer wrote: >> >> >> >> Your lists are very short. Pump them up to thousands of elements each >> >> and you will see a problem emerge in the naive solution. >> >> >> >> On Sun, Apr 3, 2016 at 12:16 AM, Arseniy Alekseyev >> >> wrote: >> >> > I measure the following naive solution of interleave2 beating yours >> in >> >> > performance: >> >> > >> >> > i2 [] ys = [ys] >> >> > i2 xs [] = [xs] >> >> > i2 (x : xs) (y : ys) = >> >> > fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) >> >> > >> >> > The program I'm benchmarking is: >> >> > >> >> > main = print $ sum $ map sum $ interleavings >> >> > [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] >> >> > >> >> > >> >> > >> >> > On 3 April 2016 at 04:05, David Feuer wrote: >> >> >> >> >> >> I ran into a fun question today: >> >> >> http://stackoverflow.com/q/36342967/1477667 >> >> >> >> >> >> Specifically, it asks how to find all ways to interleave lists so >> that >> >> >> the order of elements within each list is preserved. The most >> >> >> efficient way I found is copied below. It's nicely lazy, and avoids >> >> >> left-nested appends. Unfortunately, it's pretty seriously ugly. Does >> >> >> anyone have any idea of a way to do this that's both efficient and >> >> >> elegant? >> >> >> >> >> >> {-# LANGUAGE BangPatterns #-} >> >> >> import Data.Monoid >> >> >> import Data.Foldable (toList) >> >> >> import Data.Sequence (Seq, (|>)) >> >> >> >> >> >> -- Find all ways to interleave two lists >> >> >> interleave2 :: [a] -> [a] -> [[a]] >> >> >> interleave2 xs ys = interleave2' mempty xs ys [] >> >> >> >> >> >> -- Find all ways to interleave two lists, adding the >> >> >> -- given prefix to each result and continuing with >> >> >> -- a given list to append >> >> >> interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >> >> >> interleave2' !prefix xs ys rest = >> >> >> (toList prefix ++ xs ++ ys) >> >> >> : interleave2'' prefix xs ys rest >> >> >> >> >> >> -- Find all ways to interleave two lists except for >> >> >> -- the trivial case of just appending them. Glom >> >> >> -- the results onto the given list. >> >> >> interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >> >> >> interleave2'' !prefix [] _ = id >> >> >> interleave2'' !prefix _ [] = id >> >> >> interleave2'' !prefix xs@(x : xs') ys@(y : ys') = >> >> >> interleave2' (prefix |> y) xs ys' . >> >> >> interleave2'' (prefix |> x) xs' ys >> >> >> >> >> >> -- What the question poser wanted; I don't *think* there's >> >> >> -- anything terribly interesting to do here. >> >> >> interleavings :: [[a]] -> [[a]] >> >> >> interleavings = foldr (concatMap . interleave2) [[]] >> >> >> >> >> >> >> >> >> Thanks, >> >> >> David >> >> >> _______________________________________________ >> >> >> Haskell-Cafe mailing list >> >> >> Haskell-Cafe at haskell.org >> >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > >> >> > >> > >> > >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Sun Apr 3 05:17:29 2016 From: david.feuer at gmail.com (David Feuer) Date: Sun, 3 Apr 2016 01:17:29 -0400 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: By the way, I have a bit of an unfair advantage because a lot of these things came up in the redesign of Data.List.inits. I know I can improve my constant factors by using a simpler, less flexible queue implementation than Data.Sequence, but that's a whole different issue. On Apr 3, 2016 1:14 AM, "David Feuer" wrote: > I choose the `force (map head)` attack. > On Apr 3, 2016 1:04 AM, "Arseniy Alekseyev" > wrote: > >> I see! At this point I'd say that you probably have the wrong type: there >> are ways to produce n'th interleaving much faster, but let's continue >> optimizing for the hell of it! >> >> i2 :: ([a] -> [b]) -> [a] -> [a] -> [[b]] -> [[b]] >> i2 f [] ys = (f ys :) >> i2 f xs [] = (f xs :) >> i2 f (x : xs) (y : ys) = >> i2 (f . (x :)) xs (y : ys) . i2 (f . (y :)) (x : xs) ys >> >> interleave2 xs ys = i2 id xs ys [] >> >> Seems faster than your original solution on examples I tried it on and it >> has fewer characters. :) >> >> On 3 April 2016 at 05:41, David Feuer wrote: >> >>> Of course, but something like take k . (!! m) will cut it down nicely. >>> >>> On Sun, Apr 3, 2016 at 12:39 AM, Arseniy Alekseyev >>> wrote: >>> > Um, the result is exponential in size. A problem will emerge in any >>> > solution. :) >>> > >>> > On 3 April 2016 at 05:38, David Feuer wrote: >>> >> >>> >> Your lists are very short. Pump them up to thousands of elements each >>> >> and you will see a problem emerge in the naive solution. >>> >> >>> >> On Sun, Apr 3, 2016 at 12:16 AM, Arseniy Alekseyev >>> >> wrote: >>> >> > I measure the following naive solution of interleave2 beating yours >>> in >>> >> > performance: >>> >> > >>> >> > i2 [] ys = [ys] >>> >> > i2 xs [] = [xs] >>> >> > i2 (x : xs) (y : ys) = >>> >> > fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) >>> >> > >>> >> > The program I'm benchmarking is: >>> >> > >>> >> > main = print $ sum $ map sum $ interleavings >>> >> > [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] >>> >> > >>> >> > >>> >> > >>> >> > On 3 April 2016 at 04:05, David Feuer >>> wrote: >>> >> >> >>> >> >> I ran into a fun question today: >>> >> >> http://stackoverflow.com/q/36342967/1477667 >>> >> >> >>> >> >> Specifically, it asks how to find all ways to interleave lists so >>> that >>> >> >> the order of elements within each list is preserved. The most >>> >> >> efficient way I found is copied below. It's nicely lazy, and avoids >>> >> >> left-nested appends. Unfortunately, it's pretty seriously ugly. >>> Does >>> >> >> anyone have any idea of a way to do this that's both efficient and >>> >> >> elegant? >>> >> >> >>> >> >> {-# LANGUAGE BangPatterns #-} >>> >> >> import Data.Monoid >>> >> >> import Data.Foldable (toList) >>> >> >> import Data.Sequence (Seq, (|>)) >>> >> >> >>> >> >> -- Find all ways to interleave two lists >>> >> >> interleave2 :: [a] -> [a] -> [[a]] >>> >> >> interleave2 xs ys = interleave2' mempty xs ys [] >>> >> >> >>> >> >> -- Find all ways to interleave two lists, adding the >>> >> >> -- given prefix to each result and continuing with >>> >> >> -- a given list to append >>> >> >> interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >>> >> >> interleave2' !prefix xs ys rest = >>> >> >> (toList prefix ++ xs ++ ys) >>> >> >> : interleave2'' prefix xs ys rest >>> >> >> >>> >> >> -- Find all ways to interleave two lists except for >>> >> >> -- the trivial case of just appending them. Glom >>> >> >> -- the results onto the given list. >>> >> >> interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >>> >> >> interleave2'' !prefix [] _ = id >>> >> >> interleave2'' !prefix _ [] = id >>> >> >> interleave2'' !prefix xs@(x : xs') ys@(y : ys') = >>> >> >> interleave2' (prefix |> y) xs ys' . >>> >> >> interleave2'' (prefix |> x) xs' ys >>> >> >> >>> >> >> -- What the question poser wanted; I don't *think* there's >>> >> >> -- anything terribly interesting to do here. >>> >> >> interleavings :: [[a]] -> [[a]] >>> >> >> interleavings = foldr (concatMap . interleave2) [[]] >>> >> >> >>> >> >> >>> >> >> Thanks, >>> >> >> David >>> >> >> _______________________________________________ >>> >> >> Haskell-Cafe mailing list >>> >> >> Haskell-Cafe at haskell.org >>> >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> > >>> >> > >>> > >>> > >>> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Sun Apr 3 05:20:08 2016 From: david.feuer at gmail.com (David Feuer) Date: Sun, 3 Apr 2016 01:20:08 -0400 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: Er.. I mean force . map head On Apr 3, 2016 1:14 AM, "David Feuer" wrote: > I choose the `force (map head)` attack. > On Apr 3, 2016 1:04 AM, "Arseniy Alekseyev" > wrote: > >> I see! At this point I'd say that you probably have the wrong type: there >> are ways to produce n'th interleaving much faster, but let's continue >> optimizing for the hell of it! >> >> i2 :: ([a] -> [b]) -> [a] -> [a] -> [[b]] -> [[b]] >> i2 f [] ys = (f ys :) >> i2 f xs [] = (f xs :) >> i2 f (x : xs) (y : ys) = >> i2 (f . (x :)) xs (y : ys) . i2 (f . (y :)) (x : xs) ys >> >> interleave2 xs ys = i2 id xs ys [] >> >> Seems faster than your original solution on examples I tried it on and it >> has fewer characters. :) >> >> On 3 April 2016 at 05:41, David Feuer wrote: >> >>> Of course, but something like take k . (!! m) will cut it down nicely. >>> >>> On Sun, Apr 3, 2016 at 12:39 AM, Arseniy Alekseyev >>> wrote: >>> > Um, the result is exponential in size. A problem will emerge in any >>> > solution. :) >>> > >>> > On 3 April 2016 at 05:38, David Feuer wrote: >>> >> >>> >> Your lists are very short. Pump them up to thousands of elements each >>> >> and you will see a problem emerge in the naive solution. >>> >> >>> >> On Sun, Apr 3, 2016 at 12:16 AM, Arseniy Alekseyev >>> >> wrote: >>> >> > I measure the following naive solution of interleave2 beating yours >>> in >>> >> > performance: >>> >> > >>> >> > i2 [] ys = [ys] >>> >> > i2 xs [] = [xs] >>> >> > i2 (x : xs) (y : ys) = >>> >> > fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) >>> >> > >>> >> > The program I'm benchmarking is: >>> >> > >>> >> > main = print $ sum $ map sum $ interleavings >>> >> > [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] >>> >> > >>> >> > >>> >> > >>> >> > On 3 April 2016 at 04:05, David Feuer >>> wrote: >>> >> >> >>> >> >> I ran into a fun question today: >>> >> >> http://stackoverflow.com/q/36342967/1477667 >>> >> >> >>> >> >> Specifically, it asks how to find all ways to interleave lists so >>> that >>> >> >> the order of elements within each list is preserved. The most >>> >> >> efficient way I found is copied below. It's nicely lazy, and avoids >>> >> >> left-nested appends. Unfortunately, it's pretty seriously ugly. >>> Does >>> >> >> anyone have any idea of a way to do this that's both efficient and >>> >> >> elegant? >>> >> >> >>> >> >> {-# LANGUAGE BangPatterns #-} >>> >> >> import Data.Monoid >>> >> >> import Data.Foldable (toList) >>> >> >> import Data.Sequence (Seq, (|>)) >>> >> >> >>> >> >> -- Find all ways to interleave two lists >>> >> >> interleave2 :: [a] -> [a] -> [[a]] >>> >> >> interleave2 xs ys = interleave2' mempty xs ys [] >>> >> >> >>> >> >> -- Find all ways to interleave two lists, adding the >>> >> >> -- given prefix to each result and continuing with >>> >> >> -- a given list to append >>> >> >> interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >>> >> >> interleave2' !prefix xs ys rest = >>> >> >> (toList prefix ++ xs ++ ys) >>> >> >> : interleave2'' prefix xs ys rest >>> >> >> >>> >> >> -- Find all ways to interleave two lists except for >>> >> >> -- the trivial case of just appending them. Glom >>> >> >> -- the results onto the given list. >>> >> >> interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >>> >> >> interleave2'' !prefix [] _ = id >>> >> >> interleave2'' !prefix _ [] = id >>> >> >> interleave2'' !prefix xs@(x : xs') ys@(y : ys') = >>> >> >> interleave2' (prefix |> y) xs ys' . >>> >> >> interleave2'' (prefix |> x) xs' ys >>> >> >> >>> >> >> -- What the question poser wanted; I don't *think* there's >>> >> >> -- anything terribly interesting to do here. >>> >> >> interleavings :: [[a]] -> [[a]] >>> >> >> interleavings = foldr (concatMap . interleave2) [[]] >>> >> >> >>> >> >> >>> >> >> Thanks, >>> >> >> David >>> >> >> _______________________________________________ >>> >> >> Haskell-Cafe mailing list >>> >> >> Haskell-Cafe at haskell.org >>> >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> > >>> >> > >>> > >>> > >>> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From arseniy.alekseyev at gmail.com Sun Apr 3 06:05:35 2016 From: arseniy.alekseyev at gmail.com (Arseniy Alekseyev) Date: Sun, 3 Apr 2016 07:05:35 +0100 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: That (specifically, the benchmark below) shows your thing is faster, but I'm not sure why. Maybe it's because Seq is cheaper than a closure, but maybe it's something more meaningful than that. Looks like you've guided myself roughly to your original solution now so I'm giving up. :) main = print $ sum $ map head $ take 1000000 $ interleavings [[1..100],[5..100]] On 3 April 2016 at 06:20, David Feuer wrote: > Er.. I mean force . map head > On Apr 3, 2016 1:14 AM, "David Feuer" wrote: > >> I choose the `force (map head)` attack. >> On Apr 3, 2016 1:04 AM, "Arseniy Alekseyev" >> wrote: >> >>> I see! At this point I'd say that you probably have the wrong type: >>> there are ways to produce n'th interleaving much faster, but let's continue >>> optimizing for the hell of it! >>> >>> i2 :: ([a] -> [b]) -> [a] -> [a] -> [[b]] -> [[b]] >>> i2 f [] ys = (f ys :) >>> i2 f xs [] = (f xs :) >>> i2 f (x : xs) (y : ys) = >>> i2 (f . (x :)) xs (y : ys) . i2 (f . (y :)) (x : xs) ys >>> >>> interleave2 xs ys = i2 id xs ys [] >>> >>> Seems faster than your original solution on examples I tried it on and >>> it has fewer characters. :) >>> >>> On 3 April 2016 at 05:41, David Feuer wrote: >>> >>>> Of course, but something like take k . (!! m) will cut it down nicely. >>>> >>>> On Sun, Apr 3, 2016 at 12:39 AM, Arseniy Alekseyev >>>> wrote: >>>> > Um, the result is exponential in size. A problem will emerge in any >>>> > solution. :) >>>> > >>>> > On 3 April 2016 at 05:38, David Feuer wrote: >>>> >> >>>> >> Your lists are very short. Pump them up to thousands of elements each >>>> >> and you will see a problem emerge in the naive solution. >>>> >> >>>> >> On Sun, Apr 3, 2016 at 12:16 AM, Arseniy Alekseyev >>>> >> wrote: >>>> >> > I measure the following naive solution of interleave2 beating >>>> yours in >>>> >> > performance: >>>> >> > >>>> >> > i2 [] ys = [ys] >>>> >> > i2 xs [] = [xs] >>>> >> > i2 (x : xs) (y : ys) = >>>> >> > fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) >>>> >> > >>>> >> > The program I'm benchmarking is: >>>> >> > >>>> >> > main = print $ sum $ map sum $ interleavings >>>> >> > [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] >>>> >> > >>>> >> > >>>> >> > >>>> >> > On 3 April 2016 at 04:05, David Feuer >>>> wrote: >>>> >> >> >>>> >> >> I ran into a fun question today: >>>> >> >> http://stackoverflow.com/q/36342967/1477667 >>>> >> >> >>>> >> >> Specifically, it asks how to find all ways to interleave lists so >>>> that >>>> >> >> the order of elements within each list is preserved. The most >>>> >> >> efficient way I found is copied below. It's nicely lazy, and >>>> avoids >>>> >> >> left-nested appends. Unfortunately, it's pretty seriously ugly. >>>> Does >>>> >> >> anyone have any idea of a way to do this that's both efficient and >>>> >> >> elegant? >>>> >> >> >>>> >> >> {-# LANGUAGE BangPatterns #-} >>>> >> >> import Data.Monoid >>>> >> >> import Data.Foldable (toList) >>>> >> >> import Data.Sequence (Seq, (|>)) >>>> >> >> >>>> >> >> -- Find all ways to interleave two lists >>>> >> >> interleave2 :: [a] -> [a] -> [[a]] >>>> >> >> interleave2 xs ys = interleave2' mempty xs ys [] >>>> >> >> >>>> >> >> -- Find all ways to interleave two lists, adding the >>>> >> >> -- given prefix to each result and continuing with >>>> >> >> -- a given list to append >>>> >> >> interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >>>> >> >> interleave2' !prefix xs ys rest = >>>> >> >> (toList prefix ++ xs ++ ys) >>>> >> >> : interleave2'' prefix xs ys rest >>>> >> >> >>>> >> >> -- Find all ways to interleave two lists except for >>>> >> >> -- the trivial case of just appending them. Glom >>>> >> >> -- the results onto the given list. >>>> >> >> interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >>>> >> >> interleave2'' !prefix [] _ = id >>>> >> >> interleave2'' !prefix _ [] = id >>>> >> >> interleave2'' !prefix xs@(x : xs') ys@(y : ys') = >>>> >> >> interleave2' (prefix |> y) xs ys' . >>>> >> >> interleave2'' (prefix |> x) xs' ys >>>> >> >> >>>> >> >> -- What the question poser wanted; I don't *think* there's >>>> >> >> -- anything terribly interesting to do here. >>>> >> >> interleavings :: [[a]] -> [[a]] >>>> >> >> interleavings = foldr (concatMap . interleave2) [[]] >>>> >> >> >>>> >> >> >>>> >> >> Thanks, >>>> >> >> David >>>> >> >> _______________________________________________ >>>> >> >> Haskell-Cafe mailing list >>>> >> >> Haskell-Cafe at haskell.org >>>> >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >> > >>>> >> > >>>> > >>>> > >>>> >>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From arseniy.alekseyev at gmail.com Sun Apr 3 14:03:16 2016 From: arseniy.alekseyev at gmail.com (Arseniy Alekseyev) Date: Sun, 3 Apr 2016 15:03:16 +0100 Subject: [Haskell-cafe] Fastest way to calculate all the ways to interleave two lists In-Reply-To: References: Message-ID: I asked David off-list and he explained that the reason his version is faster is that `head . toList` on Seq is O(1) and the equivalent operation on difference lists is O(n). Now I want to have a fingertree-backed [Function a b] type. :) On 3 April 2016 at 07:05, Arseniy Alekseyev wrote: > That (specifically, the benchmark below) shows your thing is faster, but > I'm not sure why. Maybe it's because Seq is cheaper than a closure, but > maybe it's something more meaningful than that. Looks like you've guided > myself roughly to your original solution now so I'm giving up. :) > > main = print $ sum $ map head $ take 1000000 $ interleavings > [[1..100],[5..100]] > > On 3 April 2016 at 06:20, David Feuer wrote: > >> Er.. I mean force . map head >> On Apr 3, 2016 1:14 AM, "David Feuer" wrote: >> >>> I choose the `force (map head)` attack. >>> On Apr 3, 2016 1:04 AM, "Arseniy Alekseyev" >>> wrote: >>> >>>> I see! At this point I'd say that you probably have the wrong type: >>>> there are ways to produce n'th interleaving much faster, but let's continue >>>> optimizing for the hell of it! >>>> >>>> i2 :: ([a] -> [b]) -> [a] -> [a] -> [[b]] -> [[b]] >>>> i2 f [] ys = (f ys :) >>>> i2 f xs [] = (f xs :) >>>> i2 f (x : xs) (y : ys) = >>>> i2 (f . (x :)) xs (y : ys) . i2 (f . (y :)) (x : xs) ys >>>> >>>> interleave2 xs ys = i2 id xs ys [] >>>> >>>> Seems faster than your original solution on examples I tried it on and >>>> it has fewer characters. :) >>>> >>>> On 3 April 2016 at 05:41, David Feuer wrote: >>>> >>>>> Of course, but something like take k . (!! m) will cut it down >>>>> nicely. >>>>> >>>>> On Sun, Apr 3, 2016 at 12:39 AM, Arseniy Alekseyev >>>>> wrote: >>>>> > Um, the result is exponential in size. A problem will emerge in any >>>>> > solution. :) >>>>> > >>>>> > On 3 April 2016 at 05:38, David Feuer wrote: >>>>> >> >>>>> >> Your lists are very short. Pump them up to thousands of elements >>>>> each >>>>> >> and you will see a problem emerge in the naive solution. >>>>> >> >>>>> >> On Sun, Apr 3, 2016 at 12:16 AM, Arseniy Alekseyev >>>>> >> wrote: >>>>> >> > I measure the following naive solution of interleave2 beating >>>>> yours in >>>>> >> > performance: >>>>> >> > >>>>> >> > i2 [] ys = [ys] >>>>> >> > i2 xs [] = [xs] >>>>> >> > i2 (x : xs) (y : ys) = >>>>> >> > fmap (x :) (i2 xs (y : ys)) ++ fmap (y :) (i2 (x : xs) ys) >>>>> >> > >>>>> >> > The program I'm benchmarking is: >>>>> >> > >>>>> >> > main = print $ sum $ map sum $ interleavings >>>>> >> > [[1,2,3,4],[5,6,7,8],[9,10,11,12],[1,1,1]] >>>>> >> > >>>>> >> > >>>>> >> > >>>>> >> > On 3 April 2016 at 04:05, David Feuer >>>>> wrote: >>>>> >> >> >>>>> >> >> I ran into a fun question today: >>>>> >> >> http://stackoverflow.com/q/36342967/1477667 >>>>> >> >> >>>>> >> >> Specifically, it asks how to find all ways to interleave lists >>>>> so that >>>>> >> >> the order of elements within each list is preserved. The most >>>>> >> >> efficient way I found is copied below. It's nicely lazy, and >>>>> avoids >>>>> >> >> left-nested appends. Unfortunately, it's pretty seriously ugly. >>>>> Does >>>>> >> >> anyone have any idea of a way to do this that's both efficient >>>>> and >>>>> >> >> elegant? >>>>> >> >> >>>>> >> >> {-# LANGUAGE BangPatterns #-} >>>>> >> >> import Data.Monoid >>>>> >> >> import Data.Foldable (toList) >>>>> >> >> import Data.Sequence (Seq, (|>)) >>>>> >> >> >>>>> >> >> -- Find all ways to interleave two lists >>>>> >> >> interleave2 :: [a] -> [a] -> [[a]] >>>>> >> >> interleave2 xs ys = interleave2' mempty xs ys [] >>>>> >> >> >>>>> >> >> -- Find all ways to interleave two lists, adding the >>>>> >> >> -- given prefix to each result and continuing with >>>>> >> >> -- a given list to append >>>>> >> >> interleave2' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >>>>> >> >> interleave2' !prefix xs ys rest = >>>>> >> >> (toList prefix ++ xs ++ ys) >>>>> >> >> : interleave2'' prefix xs ys rest >>>>> >> >> >>>>> >> >> -- Find all ways to interleave two lists except for >>>>> >> >> -- the trivial case of just appending them. Glom >>>>> >> >> -- the results onto the given list. >>>>> >> >> interleave2'' :: Seq a -> [a] -> [a] -> [[a]] -> [[a]] >>>>> >> >> interleave2'' !prefix [] _ = id >>>>> >> >> interleave2'' !prefix _ [] = id >>>>> >> >> interleave2'' !prefix xs@(x : xs') ys@(y : ys') = >>>>> >> >> interleave2' (prefix |> y) xs ys' . >>>>> >> >> interleave2'' (prefix |> x) xs' ys >>>>> >> >> >>>>> >> >> -- What the question poser wanted; I don't *think* there's >>>>> >> >> -- anything terribly interesting to do here. >>>>> >> >> interleavings :: [[a]] -> [[a]] >>>>> >> >> interleavings = foldr (concatMap . interleave2) [[]] >>>>> >> >> >>>>> >> >> >>>>> >> >> Thanks, >>>>> >> >> David >>>>> >> >> _______________________________________________ >>>>> >> >> Haskell-Cafe mailing list >>>>> >> >> Haskell-Cafe at haskell.org >>>>> >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>> >> > >>>>> >> > >>>>> > >>>>> > >>>>> >>>> >>>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spopejoy at panix.com Sun Apr 3 17:35:28 2016 From: spopejoy at panix.com (Stuart Popejoy) Date: Sun, 03 Apr 2016 13:35:28 -0400 Subject: [Haskell-cafe] ANNOUNCE: fadno-braids 0.0.2 Message-ID: <57015460.9090100@panix.com> Braids represented as Haskell types with support for generation and transformations. Artin generators, Birman-Ko-Lee band generators, isotopy/Reidemeister moves, rendering via Diagrams. https://hackage.haskell.org/package/fadno-braids-0.0.2 Thanks, Stuart From D.J.Duke at leeds.ac.uk Sun Apr 3 20:14:31 2016 From: D.J.Duke at leeds.ac.uk (David Duke) Date: Sun, 3 Apr 2016 21:14:31 +0100 Subject: [Haskell-cafe] CFP: Functional High Performance Computing 2016 Message-ID: <63D6DE7A-4560-44D3-A9A6-F7370DDB9584@leeds.ac.uk> ====================================================================== CALL FOR PAPERS FHPC 2016 The 5th ACM SIGPLAN Workshop on Functional High-Performance Computing Nara, Japan September 22, 2016 https://sites.google.com/site/fhpcworkshops/ Co-located with the International Conference on Functional Programming (ICFP 2016) Submission Deadline: Friday, 10 June, 2016 (anywhere on earth) ====================================================================== The FHPC workshop aims at bringing together researchers exploring uses of functional (or more generally, declarative or high-level) programming technology in application domains where high performance is essential. The aim of the meeting is to enable sharing of results, experiences, and novel ideas about how high-level, declarative specifications of computationally challenging problems can serve as maintainable and portable code that approaches (or even exceeds) the performance of machine-oriented imperative implementations. All aspects of performance critical programming and parallel programming are in-scope for the workshop, irrespective of hardware target. This includes both traditional large-scale scientific computing (HPC), as well as work targeting single node systems with SMPs, GPUs, FPGAs, or embedded processors. It is becoming apparent that radically new and well founded methodologies for programming such systems are required to address their inherent complexity and to reconcile execution performance with programming productivity. Experience reports are also welcome. Proceedings: ============ FHPC 2016 seeks to encourage a range of submissions, focussing on work in progress and facilitating early exchange of ideas and open discussion on innovative and/or emerging results. To this end submissions should take the form of short (maximum 6 page) papers. Accepted papers will be published by the ACM and will appear in the ACM Digital Library. * Submissions due: Friday, 10 June, 2016 (anywhere on earth) * Author notification: Friday, 8 July, 2016 * Final copy due: Sunday, 31 July, 2016 Submitted papers must be in portable document format (PDF), formatted according to the ACM SIGPLAN style guidelines (2 column, 9pt format). See http://www.sigplan.org/authorInformation.htm for more information and style files. Papers should be no longer than 6 pages. Contributions to FHPC 2016 should be submitted via Easychair, at the following URL: * https://www.easychair.org/conferences/?conf=fhpc16 The FHPC workshops adhere to the ACM SIGPLAN policies regarding programme committee contributions and republication. Any paper submitted must adhere to ACM SIGPLAN's republication policy. PC member submissions are welcome, but will be reviewed to a higher standard. http://www.sigplan.org/Resources/Policies/Review http://www.sigplan.org/Resources/Policies/Republication Travel Support: =============== Student attendees with accepted papers can apply for a SIGPLAN PAC grant to help cover travel expenses. PAC also offers other support, such as for child-care expenses during the meeting or for travel costs for companions of SIGPLAN members with physical disabilities, as well as for travel from locations outside of North America and Europe. For details on the PAC programme, see its web page (http://www.sigplan.org/PAC.htm). Programme Committee: ==================== David Duke (co-chair) University of Leeds, UK Yukiyoshi Kameyama (co-chair) University of Tsukuba, Japan Baris Aktemur ?zye?in University, Turkey Marco Aldinucci University of Torino, Italy Jost Berthold Commonwealth Bank, Australia Kei Davis Los Alamos National Laboratory, USA Kento Emoto Kyushu Institute of Technology, Japan Zhenjiang Hu National Institute of Informatics, Japan Ben Lippmeier University of New South Wales, Australia Rita Loogen University of Marburg, Germany Geoffrey Mainland Drexel University, USA Mike Rainey INRIA, France Mary Sheeran Chalmers University of Technology, Sweden Satnam Singh Facebook, UK From mihai.maruseac at gmail.com Sun Apr 3 23:24:10 2016 From: mihai.maruseac at gmail.com (Mihai Maruseac) Date: Sun, 3 Apr 2016 19:24:10 -0400 Subject: [Haskell-cafe] Call for Contributions - Haskell Communities and Activities Report, May 2016 edition (30th edition) Message-ID: Dear all, It's that time of the year again (https://ro-che.info/ccc/16). :) We would like to collect contributions for the 30th edition of the ============================================================ Haskell Communities & Activities Report http://www.haskell.org/haskellwiki/Haskell_Communities_and_Activities_Report Submission deadline: 30 April 2016 ============================================================ The short story follows: * If you are working on _any_ project that is in some way related to Haskell, please write a short entry and submit it. Even if the project is small, unfinished or used only by yourself or you think it is not important enough, please reconsider and submit an entry anyway! * The submission file can be in _any_ format you like. Although the final report uses LaTeX, if it is easier for you to submit a Markdown file, text file, Doc file or anything else, please do so. We'll be happy to do the translation and get a new entry in the HCAR :) * If you are interested in an existing project related to Haskell that has not previously been mentioned in the HCAR, please tell me or contact a project leader to get them to submit an entry. We have received feedback in the past that some projects were missing from the edition, but, sadly, that was too late at the time, but those projects will be contacted for this edition. * Feel free to pass on this call for contribution to others that might be interested. More detailed information: The Haskell Communities & Activities Report is a bi-annual overview of the state of Haskell as well as Haskell-related projects over the last, and possibly the upcoming six months. If you have only recently been exposed to Haskell, it might be a good idea to browse the previous edition --- you will find interesting projects described as well as several starting points and links that may provide answers to many questions. Contributions will be collected until the submission deadline. They will then be compiled into a coherent report that is published online as soon as it is ready. As always, this is a great opportunity to update your webpages, make new releases, announce or even start new projects, or to talk about developments you want every Haskeller to know about! Looking forward to your contributions, Mihai FAQ: Q: What format should I write in? A: The recommeneded format is a LaTeX source file, adhering to the template that is available at: http://haskell.org/communities/05-2016/template.tex There is also a LaTeX style file at http://haskell.org/communities/06-2016/hcar.sty that you can use to preview your entry. If you modify an old entry that you have written for an earlier edition of the report, you should soon receive your old entry as a template (provided we have your valid email address). Please modify that template, rather than using your own version of the old entry as a template. _However_, if you don't want/have time to format the entry for LaTeX, you can submit it in any other format possible and we will be happy to convert it for the final report. Q: Can I include Haskell code? A: Yes. Please use lhs2tex syntax (http://www.andres-loeh.de/lhs2tex/). The report is compiled in mode polycode.fmt. Q: Can I include images? A: Yes, you are even encouraged to do so. Please use .jpg or .png format, then, PNG being preferred for simplicity. Q: How much should I write? A: Authors are asked to limit entries to about one column of text. A general introduction is helpful. Apart from that, you should focus on recent or upcoming developments. Pointers to online content can be given for more comprehensive or "historic" overviews of a project. Images do not count towards the length limit, so you may want to use this opportunity to pep up entries. There is no minimum length of an entry! The report aims for being as complete as possible, so please consider writing an entry, even if it is only a few lines long. Q: Which topics are relevant? A: All topics which are related to Haskell in some way are relevant. We usually had reports from users of Haskell (private, academic, or commercial), from authors or contributors to projects related to Haskell, from people working on the Haskell language, libraries, on language extensions or variants. We also like reports about distributions of Haskell software, Haskell infrastructure, books and tutorials on Haskell. Reports on past and upcoming events related to Haskell are also relevant. Finally, there might be new topics we do not even think about. As a rule of thumb: if in doubt, then it probably is relevant and has a place in the HCAR. You can also simply ask us. Q: Is unfinished work relevant? Are ideas for projects relevant? A: Yes! You can use the HCAR to talk about projects you are currently working on. You can use it to look for other developers that might help you. You can use HCAR to ask for more contributors to your project, it is a good way to gain visibility and traction. Q: If I do not update my entry, but want to keep it in the report, what should I do? A: Tell us that there are no changes. The old entry will typically be reused in this case, but it might be dropped if it is older than a year, to give more room and more attention to projects that change a lot. Do not resend complete entries if you have not changed them. Q: Will I get confirmation if I send an entry? How do I know whether my email has even reached its destination, and not ended up in a spam folder? A: Prior to publication of the final report, we will send a draft to all contributors, for possible corrections. So if you do not hear from us within two weeks after the deadline, it is safer to send another mail and check whether your first one was received. -- Mihai Maruseac (MM) "If you can't solve a problem, then there's an easier problem you can solve: find it." -- George Polya From rrnewton at gmail.com Mon Apr 4 05:06:13 2016 From: rrnewton at gmail.com (Ryan Newton) Date: Mon, 4 Apr 2016 01:06:13 -0400 Subject: [Haskell-cafe] Benchmarking harnesses for a more modern nofib? Message-ID: Hi all, Is anyone currently working in, or interested in helping with, a new benchmark suite for Haskell? Perhaps, packaging up existing apps and app benchmarks into a new benchmark suite that gives a broad picture of Haskell application performance today? Background: We run nofib, and we run the shootout benchmarks. But when we want to evaluate basic changes to GHC optimizations or data representation, these really don't give us a full picture of whether a change is beneficial. A few years ago, fibon tried to gather some Hackage benchmarks. This may work even better with Stackage, where there are 180 benchmark suites among the 1770 packages currently. Also, these days companies are building substantial apps in Hackage. Which substantial apps could or should go into a benchmark suite? I see Warp and other web server benchmarks all over the web. But is there a harness that can time some of this code while running inside a single-machine, easy-setup benchmark suite? Best, -Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From rrnewton at gmail.com Mon Apr 4 05:07:32 2016 From: rrnewton at gmail.com (Ryan Newton) Date: Mon, 4 Apr 2016 01:07:32 -0400 Subject: [Haskell-cafe] Benchmarking harnesses for a more modern nofib? In-Reply-To: References: Message-ID: Sorry, bit too late: excuse typos: Also, these days companies are building substantial apps in Hackage. > In *Haskell*, of course. -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Mon Apr 4 07:45:23 2016 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Mon, 4 Apr 2016 07:45:23 +0000 Subject: [Haskell-cafe] Benchmarking harnesses for a more modern nofib? In-Reply-To: References: Message-ID: <30f3313fdc904390895716339b172cb8@DB4PR30MB030.064d.mgd.msft.net> Is anyone currently working in, or interested in helping with, a new benchmark suite for Haskell? Perhaps, packaging up existing apps and app benchmarks into a new benchmark suite that gives a broad picture of Haskell application performance today? I would love to see this done. nofib is showing its age. An incentive is this: we benchmark GHC against nofib pretty regularly, and pay attention to regressions. If your program is in the benchmark suite, it?s more likely that its performance will be good and stay good. The tension is that, to be usable, it must be possible to actually run the benchmark suite, on a variety of platforms, without consuming too much time. ? nofib has zero package dependencies. Adding some dependencies is fine, but it adding zillions is not. Often they can be cut down because some of the dependencies are related to incidental features of the benchmark that can be stubbed off. ? More seriously, for figures to be comparable we have to compare the same code. So any package dependencies must be hard dependencies on particular versions. And as GHC moves on, those packages may require (hopefully minor) updates to stay working. ? Test data and test environment can be a challenge, especially for things like web servers. Again we don?t to force the developer to install too much other stuff. All that said, it must be possible to do MUCH better than we are right now, with a 20-year old suite! Please do join Ryan in working on this. Simon From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Ryan Newton Sent: 04 April 2016 06:06 To: ghc-devs at haskell.org; Haskell Cafe Subject: Benchmarking harnesses for a more modern nofib? Hi all, Is anyone currently working in, or interested in helping with, a new benchmark suite for Haskell? Perhaps, packaging up existing apps and app benchmarks into a new benchmark suite that gives a broad picture of Haskell application performance today? Background: We run nofib, and we run the shootout benchmarks. But when we want to evaluate basic changes to GHC optimizations or data representation, these really don't give us a full picture of whether a change is beneficial. A few years ago, fibon tried to gather some Hackage benchmarks. This may work even better with Stackage, where there are 180 benchmark suites among the 1770 packages currently. Also, these days companies are building substantial apps in Hackage. Which substantial apps could or should go into a benchmark suite? I see Warp and other web server benchmarks all over the web. But is there a harness that can time some of this code while running inside a single-machine, easy-setup benchmark suite? Best, -Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Mon Apr 4 08:32:11 2016 From: mail at joachim-breitner.de (Joachim Breitner) Date: Mon, 04 Apr 2016 10:32:11 +0200 Subject: [Haskell-cafe] Benchmarking harnesses for a more modern nofib? In-Reply-To: References: Message-ID: <1459758731.1677.6.camel@joachim-breitner.de> Hi, definitely interested. I have just talked about this with Richard yesterday, and we quite agree with what you observed. As the maintainer of http://perf.haskell.org/ghc, I?d very much welcome better data! Note that fibon already has bitrotted, and does not quite work any more. So there is some low hanging fruit in resurrecting that one. Simon mentioned a few points, such as dependencies. But note that you can relatively easily dump the dependencies?s modules in your source repository to both bundle and freeze them. I?d prefer that to (even strict) dependencies to something external, as that lowers the barrier for developers to actually run the benchmarks! Another important step in that direction would be to define a common output for benchmark suites defined in .cabal files, so it is easier to set up things like?http://perf.haskell.org/ghc?and?http://perf.haskell. org/binary?for?these projects. About the harness: haskell.org is currently paying a student (CCed) to setup a travis-like infrastructure based on gipeda (the software behind perf.haskell.org) that would allow library authors to very simply get continuous benchmark measurements. Let?s see what comes out of that! Greetings, Joachim Am Montag, den 04.04.2016, 01:06 -0400 schrieb Ryan Newton: > Hi all, > > Is anyone currently working in, or interested in helping with, a new > benchmark suite for Haskell?? Perhaps, packaging up existing apps and > app benchmarks into a new benchmark suite that gives a broad picture > of Haskell application performance today? > > Background: We run nofib, and we run the shootout benchmarks.? But > when we want to evaluate basic changes to GHC optimizations or data > representation, these really don't give us a full picture of whether > a change is beneficial. > > A few years ago, fibon?tried to gather some Hackage benchmarks.? This > may work even better with Stackage, where there are 180 benchmark > suites among the 1770 packages currently. > > Also, these days companies are building substantial apps in Hackage.? > Which substantial apps could or should go into a benchmark suite?? I > see?Warp and other web server benchmarks?all over the web.? But is > there a harness that can time some of this code while running inside > a single-machine, easy-setup benchmark suite? > > Best, > ? -Ryan > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -- Joachim ?nomeata? Breitner ? mail at joachim-breitner.de ? https://www.joachim-breitner.de/ ? XMPP: nomeata at joachim-breitner.de?? OpenPGP-Key: 0xF0FBF51F ? Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From mrr at sru-systems.com Mon Apr 4 19:32:10 2016 From: mrr at sru-systems.com (Martijn Rijkeboer) Date: Mon, 4 Apr 2016 21:32:10 +0200 Subject: [Haskell-cafe] [ANN] protobuf-simple: Protocol Buffers library Message-ID: Hello, I've just released protobuf-simple, an Haskell implementation of Google's Protocol Buffers with an emphasis on simplicity. This implementation consists of a library for the encoding and decoding of data and an executable for generating Haskell types from proto files. The code can be found at https://github.com/sru-systems/protobuf-simple Kind regards, Martijn Rijkeboer From blaze at ruddy.ru Mon Apr 4 19:48:16 2016 From: blaze at ruddy.ru (Andrey Sverdlichenko) Date: Mon, 04 Apr 2016 19:48:16 +0000 Subject: [Haskell-cafe] [ANN] bond-haskell: yet another data serialization library Message-ID: bond-haskell and bond-haskell-compiler is a pair of packages adding Haskell support to bond serialization framework. Bond is an open source, cross-platform framework for working with schematized data. It supports cross-language serialization/deserialization and powerful generic mechanisms for efficiently manipulating data. It is broadly used at Microsoft in high scale services. For a discussion how Bond compares to similar frameworks (most notably protobufs) see https://microsoft.github.io/bond/why_bond.html Microsoft's bond package or other foreign code is not needed for building or using bond-haskell, all dependencies are published to hackage. For those interested, Microsoft's code is published at https://github.com/Microsoft/bond/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From rrnewton at gmail.com Mon Apr 4 20:35:26 2016 From: rrnewton at gmail.com (Ryan Newton) Date: Mon, 4 Apr 2016 16:35:26 -0400 Subject: [Haskell-cafe] Benchmarking harnesses for a more modern nofib? In-Reply-To: <1459758731.1677.6.camel@joachim-breitner.de> References: <1459758731.1677.6.camel@joachim-breitner.de> Message-ID: Great! I'm glad to hear folks are interested. It sounds like there is need for a better low-dependencies benchmark suite. I was just grepping through nofib looking for things that are *missing* and I realized there are no uses of atomicModifyIORef, for example. What we're working on at Indiana right this second is not quite this effort, but is the separate, complementary, effort to gather as much data as possible from a large swath of packages (high dependency-count) . Note that fibon already has bitrotted, and does not quite work any > more. So there is some low hanging fruit in resurrecting that one. > Agreed. Though I see that nofib already contains some of them. Even though stack + GHC head loses many of stack's benefits, I think that stack and cabal freeze should make it easier to keep things running for the long term than it was with fibon (which bitrotted quickly). > Another important step in that direction would be to define a common > output for benchmark suites defined in .cabal files, so it is easier to > set up things like http://perf.haskell.org/ghc and http://perf.haskell. > org/binary for these projects. > Yes, exitcode-stdio-1.0 is useful for testing but not so much for benchmarking. To attempt to harvest Stackage benchmarks we were going to just assume things are criterion and catch errors as we go. Should we go further and aim to standardize a new value for "type:" within benchmark suites? About the harness: haskell.org is currently paying a student (CCed) to > setup a travis-like infrastructure based on gipeda (the software behind > perf.haskell.org) that would allow library authors to very simply get > continuous benchmark measurements. Let?s see what comes out of that! > What's the infrastructure that currently gathers the data for perf.haskell.org? Is there a repo you can point to? (Since gipeda itself is just the presentation layer, and something else must be running things & gathering data.) Cheers, -Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Mon Apr 4 20:44:04 2016 From: mail at joachim-breitner.de (Joachim Breitner) Date: Mon, 04 Apr 2016 22:44:04 +0200 Subject: [Haskell-cafe] Benchmarking harnesses for a more modern nofib? In-Reply-To: References: <1459758731.1677.6.camel@joachim-breitner.de> Message-ID: <1459802644.4559.7.camel@joachim-breitner.de> Hi Ryan, Am Montag, den 04.04.2016, 16:35 -0400 schrieb Ryan Newton: > What's the infrastructure that currently gathers the data for > perf.haskell.org?? Is there a repo you can point to? ?(Since gipeda > itself is just the presentation layer, and something else must be > running things & gathering data.) the infrastructure is my office desktop computer, which I don?t use (as I always use my laptop). There, a script? runs which polls the git repository, looks for new revisions, builds them, and pushes the logs to a dedicate repository on github? (which can be valuable data source on its own!). A cron job on a virtual machine provided to me by haskell.org polls that repository, runs gipepda, and pushes the output onto www.haskell.org,?which serves perf.haskell.org. Not the most sophisticated or robust setup, but it works. Greetings, Joachim ??https://github.com/nomeata/codespeed/blob/ghc/tools/ghc/watch.sh (the repository location is an historical artifact, I really should move this into the gipeda repo or somewhere else). ??https://github.com/nomeata/ghc-speed-logs I suggest to not do a full checkout, but rather do a bare clone and use commands like "git show" to access the files, as this repository is huge! This is also what gipeda does. -- Joachim ?nomeata? Breitner ? mail at joachim-breitner.de ? https://www.joachim-breitner.de/ ? XMPP: nomeata at joachim-breitner.de?? OpenPGP-Key: 0xF0FBF51F ? Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From ganesh at earth.li Mon Apr 4 21:36:49 2016 From: ganesh at earth.li (Ganesh Sittampalam) Date: Mon, 4 Apr 2016 22:36:49 +0100 Subject: [Haskell-cafe] Darcs+Pijul Hacking Sprint #11 (May 6th-8th, Helsinki) Message-ID: <5702DE71.2000904@earth.li> Dear Hackers, The 11th Darcs Sprint, organised by and jointly with the Pijul team, will be in Helsinki, on Friday May 6th-Sunday May 8th, at Aalto University's startup sauna in the Otaniemi Campus. Please check the details at http://pijul.org/2016/04/02/sprint.html Many thanks to Pierre-?tienne Meunier for organising it. The Darcs planning page is at: http://darcs.net/Sprints/2016-05 Here are three things to know: 1. Everybody is welcome to join us. We'd love to have you, whatever your hacking experience with Pijul or Darcs. Also, if you've got a wacky idea for the future of version control, or a cool use for the Darcs or Pijul libraries, you should join us too. 2. If you're attending please add your name to http://wiki.darcs.net/Sprints/2016-05 3. We may be able to reimburse travel costs (within reason!). Let us know if you'd like a reimbursement, and save your receipts. Many thanks to everybody who participated in our fundraising drives or who gave money on the side. Thanks also to the Software Freedom Conservancy for making fundraising and reimbursements so painless! If you can't join us in person, but you'd like to cheer us on, say hello at http://darcs.net/Donations ! See you next month! Ganesh From mitchellwrosen at gmail.com Tue Apr 5 01:27:31 2016 From: mitchellwrosen at gmail.com (Mitchell Rosen) Date: Mon, 4 Apr 2016 18:27:31 -0700 (PDT) Subject: [Haskell-cafe] [ANN] protobuf-simple: Protocol Buffers library In-Reply-To: References: Message-ID: <4fb1d10b-59b9-49ae-a11c-12ef1547b539@googlegroups.com> How does this compare to https://hackage.haskell.org/package/protobuf? On Monday, April 4, 2016 at 12:32:24 PM UTC-7, Martijn Rijkeboer wrote: > > Hello, > > I've just released protobuf-simple, an Haskell implementation of Google's > Protocol Buffers with an emphasis on simplicity. This implementation > consists of a library for the encoding and decoding of data and an > executable for generating Haskell types from proto files. > > The code can be found at https://github.com/sru-systems/protobuf-simple > > Kind regards, > > > Martijn Rijkeboer > > _______________________________________________ > Haskell-Cafe mailing list > Haskel... at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Graham.Hutton at nottingham.ac.uk Tue Apr 5 08:34:47 2016 From: Graham.Hutton at nottingham.ac.uk (Graham Hutton) Date: Tue, 5 Apr 2016 08:34:47 +0000 Subject: [Haskell-cafe] Journal of Functional Programming - Call for PhD Abstracts Message-ID: If you or one of your students recently completed a PhD in the area of functional programming, please submit the dissertation abstract for publication in JFP: simple process, no refereeing, deadline 30th April 2016. Best wishes, Graham ============================================================ CALL FOR PHD ABSTRACTS Journal of Functional Programming Deadline: 30th April 2016 http://tinyurl.com/jfp-phd-abstracts ============================================================ PREAMBLE: Many students complete PhDs in functional programming each year. As a service to the community, the Journal of Functional Programming publishes the abstracts from PhD dissertations completed during the previous year. The abstracts are made freely available on the JFP website, i.e. not behind any paywall. They do not require any transfer of copyright, merely a license from the author. A dissertation is eligible for inclusion if parts of it have or could have appeared in JFP, that is, if it is in the general area of functional programming. The abstracts are not reviewed. Please submit dissertation abstracts according to the instructions below. We welcome submissions from both the PhD student and PhD advisor/supervisor although we encourage them to coordinate. ============================================================ SUBMISSION: Please submit the following information to Graham Hutton by 30th April 2016. o Dissertation title: (including any subtitle) o Student: (full name) o Awarding institution: (full name and country) o Date of PhD award: (month and year; depending on the institution, this may be the date of the viva, corrections being approved, graduation ceremony, or otherwise) o Advisor/supervisor: (full names) o Dissertation URL: (please provide a permanently accessible link to the dissertation if you have one, such as to an institutional repository or other public archive; links to personal web pages should be considered a last resort) o Dissertation abstract: (plain text, maximum 1000 words; you may use \emph{...} for emphasis, but we prefer no other markup or formatting in the abstract, but do get in touch if this causes significant problems) Please do not submit a copy of the dissertation itself, as this is not required. JFP reserves the right to decline to publish abstracts that are not deemed appropriate. ============================================================ PHD ABSTRACT EDITOR: Graham Hutton School of Computer Science University of Nottingham Nottingham NG8 1BB United Kingdom ============================================================ This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. From mrr at sru-systems.com Tue Apr 5 14:30:31 2016 From: mrr at sru-systems.com (Martijn Rijkeboer) Date: Tue, 5 Apr 2016 16:30:31 +0200 Subject: [Haskell-cafe] [ANN] protobuf-simple: Protocol Buffers library In-Reply-To: <4fb1d10b-59b9-49ae-a11c-12ef1547b539@googlegroups.com> References: <4fb1d10b-59b9-49ae-a11c-12ef1547b539@googlegroups.com> Message-ID: <7b5ab1e1e5cde04d77ddb2a87d4aaae9.squirrel@mail.bunix.org> > How does this compare to https://hackage.haskell.org/package/protobuf? It uses "simpler" types. The Foo type in protobuf would be like the following (from the manual): data Foo = Foo { field1 :: Required 1 (Value Int64) , field2 :: Optional 2 (Value Text) , field3 :: Repeated 3 (Value Bool) } deriving (Generic, Show) In protobuf-simple it would be like the following: data Foo = Foo { field1 :: Int64 , field2 :: Maybe Text , field3 :: Seq Bool } deriving (Show, Eq, Ord) Besides this, protobuf-simple uses newtypes for messages with only one field (something we use very often). Kind regards, Martijn Rijkeboer From mrr at sru-systems.com Tue Apr 5 14:50:04 2016 From: mrr at sru-systems.com (Martijn Rijkeboer) Date: Tue, 5 Apr 2016 16:50:04 +0200 Subject: [Haskell-cafe] [ANN] protobuf-simple: Protocol Buffers library In-Reply-To: <26e5bdd9-d358-4ebe-a03f-feef02927102@googlegroups.com> References: <26e5bdd9-d358-4ebe-a03f-feef02927102@googlegroups.com> Message-ID: <9eae101c843fd59e4d91813178bd0553.squirrel@mail.bunix.org> Hi Alain, > What version of Protocol Buffer are you supporting (I did not find this > info, sorry) ? Are you planning on supporting the V3 if you don't > already? The protobuf-simple library only supports V2. The version wasn't specified anywhere, my bad. I've just added it to the readme. Currently I have no plans supporting V3, since I have no use for it. However, pull requests are always welcome, providing that the library remains "simple". Kind regards, Martijn Rijkeboer From blaze at ruddy.ru Tue Apr 5 14:56:09 2016 From: blaze at ruddy.ru (Andrey Sverdlichenko) Date: Tue, 05 Apr 2016 14:56:09 +0000 Subject: [Haskell-cafe] [ANN] protobuf-simple: Protocol Buffers library In-Reply-To: <7b5ab1e1e5cde04d77ddb2a87d4aaae9.squirrel@mail.bunix.org> References: <4fb1d10b-59b9-49ae-a11c-12ef1547b539@googlegroups.com> <7b5ab1e1e5cde04d77ddb2a87d4aaae9.squirrel@mail.bunix.org> Message-ID: Isn't http://hackage.haskell.org/package/protocol-buffers doing the same thing with records? On Tue, 5 Apr 2016 at 07:30, Martijn Rijkeboer wrote: > > How does this compare to https://hackage.haskell.org/package/protobuf? > > It uses "simpler" types. The Foo type in protobuf would be like > the following (from the manual): > > data Foo = Foo > { field1 :: Required 1 (Value Int64) > , field2 :: Optional 2 (Value Text) > , field3 :: Repeated 3 (Value Bool) > } deriving (Generic, Show) > > > In protobuf-simple it would be like the following: > > data Foo = Foo > { field1 :: Int64 > , field2 :: Maybe Text > , field3 :: Seq Bool > } deriving (Show, Eq, Ord) > > > Besides this, protobuf-simple uses newtypes for messages with only one > field (something we use very often). > > Kind regards, > > > Martijn Rijkeboer > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrr at sru-systems.com Tue Apr 5 15:13:29 2016 From: mrr at sru-systems.com (Martijn Rijkeboer) Date: Tue, 5 Apr 2016 17:13:29 +0200 Subject: [Haskell-cafe] [ANN] protobuf-simple: Protocol Buffers library In-Reply-To: References: <4fb1d10b-59b9-49ae-a11c-12ef1547b539@googlegroups.com> <7b5ab1e1e5cde04d77ddb2a87d4aaae9.squirrel@mail.bunix.org> Message-ID: <7e3b4e8bb624a9502ddf46d610d04f1b.squirrel@mail.bunix.org> > Isn't http://hackage.haskell.org/package/protocol-buffers doing the same > thing with records? They're quite similar, however protobuf-simple uses Data.Text instead of Data.ByteString for strings. Furthermore it generates newtypes instead of data types for messages with only one field. Kind regards, Martijn Rijkeboer From doug at cs.dartmouth.edu Tue Apr 5 20:12:15 2016 From: doug at cs.dartmouth.edu (Doug McIlroy) Date: Tue, 05 Apr 2016 16:12:15 -0400 Subject: [Haskell-cafe] Documenting extensions Message-ID: <201604052012.u35KCFtx015545@coolidge.cs.Dartmouth.EDU> I'd like to believe the Haskell report is a bible. I learned H98 using the Prelude as a source of examples and Hugs as a testbed. That was a comfortable and rewarding combination. Later I discovered that by default GHC rejected almost all my report-conforming (H98 and H2010) code. Ironically, its website at the time asserted, "Haskell is a standard language." In fact, far from reflecting biblical authority, the de facto Haskell discussed in this cafe comes in some 2^99 flavors -- enough to use a different language for every run of the compiler for the life of the universe. Witness: ghc --supported-languages | grep -v '^No[A-Z]' | wc -l (99 is the answer for GHC 7.8.4. In fact not all combinations of -X options are legal, but you get the point.) Unfortunately there is no coherent discussion of all those Haskells. The extensions section of the GHC User Guide gives no formal syntax, often teaches semantics only by example, and is replete with sales pitches, partial analogies, inconsistent terminology, and (helpful) appeals to outside sources. Definitely not a bible. I understand that many GHC extensions are probationary. Nevertheless, in the interest of facilitating their full and correct use, I would plead that a report-grade description accompany each language feature incorporated in official releases. This seems like a small amount of effort beyond the hard work of conception and implementation. Are there cogent reasons for doing otherwise? Doug From jeffbrown.the at gmail.com Tue Apr 5 20:16:54 2016 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Tue, 5 Apr 2016 13:16:54 -0700 Subject: [Haskell-cafe] Text.Regex.matchRegex: Success is empty? Message-ID: Esteemed Haskellers, It is working for me, but I am puzzled by the matchRegex function: > import Text.Regex > :i matchRegex matchRegex :: Regex -> String -> Maybe [String] -- Defined in ?Text.Regex? Searches that fail return Nothing: > matchRegex (mkRegex "z") "abracadabra" Nothing which makes sense. But why do searches that succeed return an empty list of Strings? > matchRegex (mkRegex "a") "abracadabra" Just [] > -- Jeffrey Benjamin Brown -------------- next part -------------- An HTML attachment was scrubbed... URL: From kiss.csongor.kiss at gmail.com Tue Apr 5 20:23:59 2016 From: kiss.csongor.kiss at gmail.com (Kiss Csongor) Date: Tue, 5 Apr 2016 22:23:59 +0200 Subject: [Haskell-cafe] Text.Regex.matchRegex: Success is empty? In-Reply-To: References: Message-ID: Hi Jeffrey, It returns ?Just?, because the pattern was found. The list is empty, because no capture groups are defined in the regex. matchRegex (mkRegex ?(a)?) ?abracadabra" returns Just [?a?] Csongor > On 5 Apr 2016, at 22:16, Jeffrey Brown wrote: > > Esteemed Haskellers, > > It is working for me, but I am puzzled by the matchRegex function: > > > import Text.Regex > > :i matchRegex > matchRegex :: Regex -> String -> Maybe [String] > -- Defined in ?Text.Regex? > > Searches that fail return Nothing: > > > matchRegex (mkRegex "z") "abracadabra" > Nothing > > which makes sense. But why do searches that succeed return an empty list of Strings? > > > matchRegex (mkRegex "a") "abracadabra" > Just [] > > > > -- > Jeffrey Benjamin Brown > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From adam at bergmark.nl Tue Apr 5 20:24:59 2016 From: adam at bergmark.nl (Adam Bergmark) Date: Tue, 05 Apr 2016 13:24:59 -0700 Subject: [Haskell-cafe] Text.Regex.matchRegex: Success is empty? In-Reply-To: References: Message-ID: <57041e938671734f00000000@polymail.io> The regex-compat docs say " Returns:? https://hackage.haskell.org/packages/archive/base/4.5.0.0/doc/html/Data-Maybe.html#v:Just ?strs ?if the match succeeded (and? strs ?is the list of subexpression matches), or? https://hackage.haskell.org/packages/archive/base/4.5.0.0/doc/html/Data-Maybe.html#v:Nothing ?otherwise. ? . Adam Bergmark On Tue 05 Apr 2016 at 22:16 Jeffrey Brown < mailto:Jeffrey Brown > wrote: Esteemed Haskellers, It is working for me, but I am puzzled by the matchRegex function: ? ? > import Text.Regex ? ? > :i matchRegex ? ? matchRegex :: Regex -> String -> Maybe [String] ? ? ? ? ? ? -- Defined in ?Text.Regex? Searches that fail return Nothing: ? ? > matchRegex (mkRegex "z") "abracadabra" ? ? Nothing which makes sense. But why do searches that succeed return an empty list of Strings? ? ? > matchRegex (mkRegex "a") "abracadabra" ? ? Just [] ? ? >? -- Jeffrey Benjamin Brown _______________________________________________ Haskell-Cafe mailing list mailto:Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at adamflott.com Tue Apr 5 20:46:45 2016 From: adam at adamflott.com (Adam Flott) Date: Tue, 5 Apr 2016 16:46:45 -0400 Subject: [Haskell-cafe] accessing the RTS -M flag value from GHC.RTS.Flags Message-ID: <11e36e30-902d-715a-d6e1-27e47bf9ce05@adamflott.com> Given, import GHC.RTS.Flags main = do gcf <- getRTSFlags print (maxHeapSize (gcFlags gcf)) And running on x86-64 in GHC 7.10.3, $ ./ghcflags 0 $ ./ghcflags +RTS -M1M 256 $ ./ghcflags +RTS -M1024K 256 $ ./ghcflags +RTS -M4096K 1024 Is there anyway I can get access to the value stored in the -M flag and depend on that value being correct? I was not able find it in the user's guide or anywhere else for that matter. Thanks, Adam From jeffbrown.the at gmail.com Tue Apr 5 21:34:13 2016 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Tue, 5 Apr 2016 14:34:13 -0700 Subject: [Haskell-cafe] Text.Regex.matchRegex: Success is empty? In-Reply-To: <57041e938671734f00000000@polymail.io> References: <57041e938671734f00000000@polymail.io> Message-ID: Aha! Thanks, Kiss! On Tue, Apr 5, 2016 at 1:24 PM, Adam Bergmark wrote: > The regex-compat docs say "Returns: Just > > strs if the match succeeded (and strs is the list of subexpression > matches), or Nothing > > otherwise.?. > > Adam Bergmark > > > On Tue 05 Apr 2016 at 22:16 Jeffrey Brown > wrote: > >> Esteemed Haskellers, >> >> It is working for me, but I am puzzled by the matchRegex function: >> >> > import Text.Regex >> > :i matchRegex >> matchRegex :: Regex -> String -> Maybe [String] >> -- Defined in ?Text.Regex? >> >> Searches that fail return Nothing: >> >> > matchRegex (mkRegex "z") "abracadabra" >> Nothing >> >> which makes sense. But why do searches that succeed return an empty list >> of Strings? >> >> > matchRegex (mkRegex "a") "abracadabra" >> Just [] >> > >> >> -- >> Jeffrey Benjamin Brown >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > -- Jeffrey Benjamin Brown -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Wed Apr 6 08:50:08 2016 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Wed, 6 Apr 2016 10:50:08 +0200 Subject: [Haskell-cafe] Documenting extensions In-Reply-To: <201604052012.u35KCFtx015545@coolidge.cs.Dartmouth.EDU> References: <201604052012.u35KCFtx015545@coolidge.cs.Dartmouth.EDU> Message-ID: <9202AE03-2122-4550-B040-007C4DD0F6DC@cis.upenn.edu> On Apr 5, 2016, at 10:12 PM, Doug McIlroy wrote: > I understand that many GHC extensions are probationary. Nevertheless, > in the interest of facilitating their full and correct use, I would > plead that a report-grade description accompany each language feature > incorporated in official releases. This seems like a small amount > of effort beyond the hard work of conception and implementation. > Are there cogent reasons for doing otherwise? Yes: we're imperfect humans with limited time. This, of course, cannot be a reason not to strive for this ideal. I would like to suggest a slight softening of this proposal: that every extension included in a release be given either a label as probationary (with a mention of its first release) or such a specification. Some extensions end up in released versions of GHC before they are fully settled, as the process of wide release gives feedback to the extension author and allows for improvement in future releases. PolyKinds/DataKinds/ConstraintKinds fit into this category in 7.4, and TypeApplications and TypeInType fit into this category for 8.0. PatternSynonyms has also undergone a bit of churn. However, older extension do deserve this level of documentation. Care to post a feature request? Richard From jake.waksbaum at gmail.com Thu Apr 7 14:29:13 2016 From: jake.waksbaum at gmail.com (Jake) Date: Thu, 07 Apr 2016 14:29:13 +0000 Subject: [Haskell-cafe] Simple Interpreter with State Monad Message-ID: I'm currently in a graphics class where, in order to provide a standard interface to all of our graphics libraries, we have to process small scripts that look like this: line 0 0 0 1 1 1 circle 0 0 10 scale 0 0 3 save pic.png I successfully wrote a parser with attoparsec that parses the file into a list of Commands. Now I'm trying to process that list to produce an IO action, and I thought the State monad would be useful to keep track of the persistent state of the shapes to draw and the transformations on them. I'm confused about how exactly to do this though. What should the type of my State be? Right now I have an execute function that is execute :: Command -> State ParseState (IO ()) where ParseState is a tuple of stuff. ParseState also includes an IO () because I wanted to be able to create multiple pictures one after another, and I couldn't figure out how to access the previous result value from State to add on to it in the next one. So can anyone offer advice on my specific situation, or maybe a simpler example of how to go about writing an interpreter with the State monad? Thanks, Jake -------------- next part -------------- An HTML attachment was scrubbed... URL: From achudnov at gmail.com Thu Apr 7 15:09:32 2016 From: achudnov at gmail.com (Andrey Chudnov) Date: Thu, 7 Apr 2016 11:09:32 -0400 Subject: [Haskell-cafe] Simple Interpreter with State Monad In-Reply-To: References: Message-ID: <5706782C.50402@gmail.com> First, if you want to use several monads at a time, you should use monad transformers (see the 'mtl' package). Then you could type your interpreter function as 'execute :: Command -> StateT ParseState IO ()' Second, ParseState including IO sounds like poor design to me (basically, in your monad you will end up carrying two pieces of IO). I can't explain how to do this better, because you haven't provided the definition of ParseState and execute. As for examples, a quick search revealed this extensive answer on StackOverflow: https://stackoverflow.com/questions/16970431/implementing-a-language-interpreter-in-haskell#16971570 For your particular case, you might want to look at free monads, as they may offer a cleaner way to implement what you want. http://www.haskellforall.com/2012/06/you-could-have-invented-free-monads.html On 04/07/2016 10:29 AM, Jake wrote: > I'm currently in a graphics class where, in order to provide a > standard interface to all of our graphics libraries, we have to > process small scripts that look like this: > > line > 0 0 0 1 1 1 > circle > 0 0 10 > scale > 0 0 3 > save > pic.png > > I successfully wrote a parser with attoparsec that parses the file > into a list of Commands. Now I'm trying to process that list to > produce an IO action, and I thought the State monad would be useful to > keep track of the persistent state of the shapes to draw and the > transformations on them. > > I'm confused about how exactly to do this though. What should the type > of my State be? Right now I have an execute function that is > execute :: Command -> State ParseState (IO ()) > where ParseState is a tuple of stuff. ParseState also includes an IO > () because I wanted to be able to create multiple pictures one after > another, and I couldn't figure out how to access the previous result > value from State to add on to it in the next one. > > So can anyone offer advice on my specific situation, or maybe a > simpler example of how to go about writing an interpreter with the > State monad? > > Thanks, > Jake > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From holgersiegel74 at yahoo.de Thu Apr 7 15:35:19 2016 From: holgersiegel74 at yahoo.de (Holger Siegel) Date: Thu, 07 Apr 2016 17:35:19 +0200 Subject: [Haskell-cafe] Simple Interpreter with State Monad In-Reply-To: References: Message-ID: <1460043319.18296.11.camel@HIS4630> Am Donnerstag, den 07.04.2016, 14:29 +0000 schrieb Jake: > I'm currently in a graphics class where, in order to provide a > standard interface to all of our graphics libraries, we have to > process small scripts that look like this: > > > line > 0 0 0 1 1 1 > circle > 0 0 10 > scale > 0 0 3 > save > pic.png > > > I successfully wrote a parser with attoparsec that parses the file > into a list of Commands. Now I'm trying to process that list to > produce an IO action, and I thought the State monad would be useful to > keep track of the persistent state of the shapes to draw and the > transformations on them. > > I'm confused about how exactly to do this though. What should the type > of my State be? Right now I have an execute function that is > execute :: Command -> State ParseState (IO ()) > where ParseState is a tuple of stuff. ParseState also includes an IO > () because I wanted to be able to create multiple pictures one after > another, and I couldn't figure out how to access the previous result > value from State to add on to it in the next one. > > > So can anyone offer advice on my specific situation, or maybe a > simpler example of how to go about writing an interpreter with the > State monad? What do you mean by 'persistent state of the shapes'? The canvas itself? You have an operation that applies a command to a canvas: evalCommand :: Canvas -> Command -> Canvas But you also want to save intermediate results, so the result has to be an IO action: runCommand :: Canvas -> Command -> IO Canvas You also have an empty initial canvas: emptyCanvas :: Canvas And finally you supply the parsed list of commands: c :: [Command] Now you want to calculate a value of type (IO Canvas) from the above: runAll :: [Command] -> IO Canvas runAll c = foldM runCommand emptyCanvas c I don't see how the state monad can make things easier here. From jackhill at jackhill.us Thu Apr 7 16:52:39 2016 From: jackhill at jackhill.us (Jack Hill) Date: Thu, 7 Apr 2016 12:52:39 -0400 (EDT) Subject: [Haskell-cafe] Building shared library to be called from C Message-ID: Hi, I'm attempting to build a shared library that can be called from C. My end goal is to build a PAM module, but for now I'm working with toy programs so that I can get a feel for building how to build the library. The Haskell part looks like this (in a file called hfact.hs) module Hfact where import Foreign import Foreign.C.Types foreign export ccall fact_hs :: CInt -> CInt fact :: Int -> Int fact x = product [1..x] fact_hs :: CInt -> CInt fact_hs = fromIntegral . fact . fromIntegral I can compile this into a so (I think successfully) with "ghc --make -shared -dynamic -fPIC -o libhfact.so hfact.hs". Now I would like to be able to call this from C. I have a C program (in a file called main.c) as follows: #include #include "HsFFI.h" #include "hfact_stub.h" int main(int argc, char *argv[]) { int user, answer; scanf("%d", &user); hs_init(&argc, &argv); answer = fact_hs(user); hs_exit(); printf("Result: %d\n", answer); return 0; } Unfortunately, I'm at a loss for how to build and link this against my so. If I try "gcc main.c -lhfact", I get many undefined symbol errors like: /nfshomes/j/jackhill/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/libHSbase-4.8.2.0-HQfYBxpPvuw8OunzQu6JGM-ghc7.10.3.so: undefined reference to `__hscore_get_saved_termios' If I try "ghc maint.c -lhfact" I get: /tmp/ghc19146_0/ghc_4.o: In function `main': ghc_3.c:(.text+0x0): multiple definition of `main' maint.o:maint.c:(.text+0x0): first defined here /tmp/ghc19146_0/ghc_4.o: In function `main': ghc_3.c:(.text+0x61): undefined reference to `ZCMain_main_closure' collect2: error: ld returned 1 exit status How should I be calling Haskell from C? Best, Jack From gk at ninebynine.org Thu Apr 7 17:05:15 2016 From: gk at ninebynine.org (Graham Klyne) Date: Thu, 07 Apr 2016 18:05:15 +0100 Subject: [Haskell-cafe] Simple Interpreter with State Monad In-Reply-To: References: Message-ID: <5706934B.9020107@ninebynine.org> On 07/04/2016 15:29, Jake wrote:> I'm currently in a graphics class where, in order to provide a standard > interface to all of our graphics libraries, we have to process small > scripts that look like this: [...] I did something like this for my Swish system, some time ago. Several others adapted the software, and most recently Doug Burke put the code in BitBucket. Relevant modules are "Scrips.hs" - originally a "parsec" based parser, but now something else, parses script source and returns a "SwishStateIO" monad. - https://bitbucket.org/doug_burke/swish/src/8f72b52f02fb540e8e1c26caa5036920a9ff31da/src/Swish/Script.hs?at=default&fileviewer=file-view-default "Monad.hs" - defines the "SwishStateIO" monad, and defines implementations of the primitive functions of the scripting language. It's a long time since I looked at this, but I think a key part of the definition is: type SwishStateIO a = StateT SwishState IO a which (if I get this right) wraps the basic state and associated transformation functions in an IO monad. - https://bitbucket.org/doug_burke/swish/src/8f72b52f02fb540e8e1c26caa5036920a9ff31da/src/Swish/Monad.hs?at=default&fileviewer=file-view-default The "compiled" script (SwishStateIO value) is run by applying it to an initial state; the module that pulls it all together is: - https://bitbucket.org/doug_burke/swish/src/8f72b52f02fb540e8e1c26caa5036920a9ff31da/src/Swish.hs?at=default&fileviewer=file-view-default ... I'm not sure if any of this makes any sense, but the key idea for me, way back when, was the capability to compile a script directly to a monadic function that could then be executed by function application to an initial state (in this case, using execStateT). #g -- On 07/04/2016 15:29, Jake wrote: > I'm currently in a graphics class where, in order to provide a standard > interface to all of our graphics libraries, we have to process small > scripts that look like this: > > line > 0 0 0 1 1 1 > circle > 0 0 10 > scale > 0 0 3 > save > pic.png > > I successfully wrote a parser with attoparsec that parses the file into a > list of Commands. Now I'm trying to process that list to produce an IO > action, and I thought the State monad would be useful to keep track of the > persistent state of the shapes to draw and the transformations on them. > > I'm confused about how exactly to do this though. What should the type of > my State be? Right now I have an execute function that is > execute :: Command -> State ParseState (IO ()) > where ParseState is a tuple of stuff. ParseState also includes an IO () > because I wanted to be able to create multiple pictures one after another, > and I couldn't figure out how to access the previous result value from > State to add on to it in the next one. > > So can anyone offer advice on my specific situation, or maybe a simpler > example of how to go about writing an interpreter with the State monad? > > Thanks, > Jake > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From jm at memorici.de Thu Apr 7 21:17:22 2016 From: jm at memorici.de (Jonn Mostovoy) Date: Thu, 7 Apr 2016 23:17:22 +0200 Subject: [Haskell-cafe] Extending Compiler With Authorized Types Message-ID: Dear friends, we are thinking about implementing the paper Authenticated Data Structures, Generically[1], but we did not have any prior experience with extending Haskell. We are informed about compiler plugins[2] and hope that writing a compiler plugin will be enough to provide machinery required by the paper, but we are not sure about it. If anyone has an opinion on bringing Authenticated Data Structures to Haskell, please share. If there is some interest in our work, we will keep you up to date in this thread. - - - References: [1]: http://f.nn.lv/o5/a7/yk/GPADS-A_Miller-Authenticated_Data_Structures_Generically.pdf [2]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/compiler-plugins.html ? Kindest regards, Jonn Mostovoy (IOHK / Serokell) -------------- next part -------------- An HTML attachment was scrubbed... URL: From tkoster at gmail.com Sat Apr 9 07:03:10 2016 From: tkoster at gmail.com (Thomas Koster) Date: Sat, 9 Apr 2016 17:03:10 +1000 Subject: [Haskell-cafe] Haskell, stack and the Atom editor Message-ID: Hi friends, I want to switch to the Atom editor for my Haskell development. I have tried several times over the last few years and given up each time because hardly anything works. I can't stand Emacs so don't bother suggesting it. I am currently using Geany, which has served me well, mostly because it is dead simple so nothing can go wrong. In addition to the usual universal text editor functions, all it does is highlight syntax (albeit with an outdated grammar), runs custom commands to build, displays clickable errors in a separate pane and underlines them in the editor pane. But for larger projects, I want more (better autocompletion, better integration with the build system, better VCS support). But back to Atom, I am having extreme difficulty getting even the basics working. I am using GHC 7.10.2, Cabal 1.22.4.0, Stack 1.0.4. I installed Atom 1.6.1 from their deb package. I installed the "language-haskell" package. This works very well, thankfully, but is the *only* thing that I can get working. I avoided "ide-haskell", even though it looks great, because their readme says it can't build with stack and I rely heavily on stack. Instead, I installed the "build" and "linter" packages and created an ".atom-build" file to build my project with stack. It invokes stack correctly, but I can't get it to recognise any errors: linter always says "No issues". I must have tried twenty different regexes in "errorMatch" but none of them seem to work. I also installed "linter-hdevtools", hoping that that may let me see some errors, but I can't get that to work either. The package is loaded but it appears to do absolutely nothing. strace does show that Atom is trying to exec hdevtools through stack, but I get no output at all within Atom as evidence that something worked or failed. hdevtools appears to have its own problems. I had installed hdevtools (0.1.2.1) with stack: stack install hdevtools I ran it myself using: stack exec --no-ghc-package-path hdevtools -- check Main.hs and it gives me the infamous error: Cabal error: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with Cabal. This is strange because "stack exec --no-ghc-package-path env" reports that no such environment variable is defined, as expected. At this point I am ready to give up yet again. Does anybody have any last-minute advice on using Atom to develop with Haskell and Stack? Thanks, Thomas Koster -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Sat Apr 9 07:54:28 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Sat, 9 Apr 2016 00:54:28 -0700 Subject: [Haskell-cafe] Haskell on OpenWRT Message-ID: <5708B534.9010109@funwithsoftware.org> Has anyone had any success running Haskell programs on OpenWRT? Specifically, I'm running OpenWRT on x86_64, so processor architecture shouldn't be an issue. However, by default OpenWRT uses musl as its C library, so binaries from a "normal" Linux system wouldn't be compatible with OpenWRT. I attempted to get around this problem by building an OpenWRT image with glibc as the C library. In theory, that ought to solve the problem. In practice, my program (a simple hello-world type program, which runs fine on Ubuntu) hung, printing nothing, using nearly all of one core, and was unkillable by any signal other than SIGKILL. If left alone to run, it eventually used all available memory and then died. I took a look at ldd, to see if there were any clues there. On my Ubuntu 12.04 machine, where I compiled the program (using ghc 7.4.1), I get: ppelletier at patrick64:~/programming/haskell$ ldd contact linux-vdso.so.1 => (0x00007fff36f50000) libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f8d49cf8000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f8d49af0000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8d497f3000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8d495eb000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8d493e7000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8d49028000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8d48e0b000) /lib64/ld-linux-x86-64.so.2 (0x00007f8d49f8d000) On my OpenWRT (trunk) box, I get: root at OpenWrt:~# ldd /tmp/contact linux-vdso.so.1 (0x00007ffd2afcc000) libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007f27a057a000) libffi.so.6 => /usr/lib/libffi.so.6 (0x00007f27a0373000) libm.so.6 => /lib/libm.so.6 (0x00007f27a0080000) librt.so.1 => /lib/librt.so.1 (0x00007f279fe79000) libdl.so.2 => /lib/libdl.so.2 (0x00007f279fc76000) libc.so.6 => /lib/libc.so.6 (0x00007f279f906000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f279f6f4000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007f279f4d9000) /lib64/ld-linux-x86-64.so.2 (0x00007f27a07dc000) This is almost the same, except it has "libgcc_s.so.1", while on the Ubuntu box it does not. I'd welcome any ideas on how to solve (or at least diagnose) this problem. I'd also be interested in any thoughts on the broader question of running Haskell programs on OpenWRT. Thanks, --Patrick From lanablack at amok.cc Sat Apr 9 08:46:18 2016 From: lanablack at amok.cc (Lana Black) Date: Sat, 09 Apr 2016 08:46:18 +0000 Subject: [Haskell-cafe] Haskell on OpenWRT In-Reply-To: <5708B534.9010109@funwithsoftware.org> References: <5708B534.9010109@funwithsoftware.org> Message-ID: <20160409084618.4378706.35395.3068@amok.cc> You will probably have better luck using ghc with musl?. Check out this thread: ?https://mail.haskell.org/pipermail/haskell-cafe/2015-May/119843.html ? Original Message ? From: Patrick Pelletier Sent: Saturday, April 9, 2016 7:54 AM To: haskell-cafe Subject: [Haskell-cafe] Haskell on OpenWRT Has anyone had any success running Haskell programs on OpenWRT? Specifically, I'm running OpenWRT on x86_64, so processor architecture shouldn't be an issue. However, by default OpenWRT uses musl as its C library, so binaries from a "normal" Linux system wouldn't be compatible with OpenWRT. I attempted to get around this problem by building an OpenWRT image with glibc as the C library. In theory, that ought to solve the problem. In practice, my program (a simple hello-world type program, which runs fine on Ubuntu) hung, printing nothing, using nearly all of one core, and was unkillable by any signal other than SIGKILL. If left alone to run, it eventually used all available memory and then died. I took a look at ldd, to see if there were any clues there. On my Ubuntu 12.04 machine, where I compiled the program (using ghc 7.4.1), I get: ppelletier at patrick64:~/programming/haskell$ ldd contact linux-vdso.so.1 => (0x00007fff36f50000) libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f8d49cf8000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f8d49af0000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8d497f3000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8d495eb000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8d493e7000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8d49028000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8d48e0b000) /lib64/ld-linux-x86-64.so.2 (0x00007f8d49f8d000) On my OpenWRT (trunk) box, I get: root at OpenWrt:~# ldd /tmp/contact linux-vdso.so.1 (0x00007ffd2afcc000) libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007f27a057a000) libffi.so.6 => /usr/lib/libffi.so.6 (0x00007f27a0373000) libm.so.6 => /lib/libm.so.6 (0x00007f27a0080000) librt.so.1 => /lib/librt.so.1 (0x00007f279fe79000) libdl.so.2 => /lib/libdl.so.2 (0x00007f279fc76000) libc.so.6 => /lib/libc.so.6 (0x00007f279f906000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f279f6f4000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007f279f4d9000) /lib64/ld-linux-x86-64.so.2 (0x00007f27a07dc000) This is almost the same, except it has "libgcc_s.so.1", while on the Ubuntu box it does not. I'd welcome any ideas on how to solve (or at least diagnose) this problem. I'd also be interested in any thoughts on the broader question of running Haskell programs on OpenWRT. Thanks, --Patrick _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From edwards.benj at gmail.com Sat Apr 9 09:57:50 2016 From: edwards.benj at gmail.com (Benjamin Edwards) Date: Sat, 09 Apr 2016 09:57:50 +0000 Subject: [Haskell-cafe] Haskell, stack and the Atom editor In-Reply-To: References: Message-ID: > I can't stand Emacs so don't bother suggesting it. I guess you'll be happy to get all this stuff working on atom yourself like the good folks working on emacs have. Ben On Sat, 9 Apr 2016 at 08:03 Thomas Koster wrote: > Hi friends, > > I want to switch to the Atom editor for my Haskell development. I have > tried several times over the last few years and given up each time because > hardly anything works. > > I can't stand Emacs so don't bother suggesting it. > > I am currently using Geany, which has served me well, mostly because it is > dead simple so nothing can go wrong. In addition to the usual universal > text editor functions, all it does is highlight syntax (albeit with an > outdated grammar), runs custom commands to build, displays clickable errors > in a separate pane and underlines them in the editor pane. But for larger > projects, I want more (better autocompletion, better integration with the > build system, better VCS support). > > But back to Atom, I am having extreme difficulty getting even the basics > working. > > I am using GHC 7.10.2, Cabal 1.22.4.0, Stack 1.0.4. > > I installed Atom 1.6.1 from their deb package. > > I installed the "language-haskell" package. This works very well, > thankfully, but is the *only* thing that I can get working. > > I avoided "ide-haskell", even though it looks great, because their readme > says it can't build with stack and I rely heavily on stack. > > Instead, I installed the "build" and "linter" packages and created an > ".atom-build" file to build my project with stack. It invokes stack > correctly, but I can't get it to recognise any errors: linter always says > "No issues". I must have tried twenty different regexes in "errorMatch" but > none of them seem to work. > > I also installed "linter-hdevtools", hoping that that may let me see some > errors, but I can't get that to work either. The package is loaded but it > appears to do absolutely nothing. strace does show that Atom is trying to > exec hdevtools through stack, but I get no output at all within Atom as > evidence that something worked or failed. > > hdevtools appears to have its own problems. I had installed hdevtools > (0.1.2.1) with stack: > stack install hdevtools > I ran it myself using: > stack exec --no-ghc-package-path hdevtools -- check Main.hs > and it gives me the infamous error: > Cabal error: Use of GHC's environment variable GHC_PACKAGE_PATH is > incompatible with Cabal. > This is strange because "stack exec --no-ghc-package-path env" reports > that no such environment variable is defined, as expected. > > At this point I am ready to give up yet again. Does anybody have any > last-minute advice on using Atom to develop with Haskell and Stack? > > Thanks, > Thomas Koster > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.thompson at kent.ac.uk Sat Apr 9 10:02:15 2016 From: s.j.thompson at kent.ac.uk (Simon Thompson) Date: Sat, 9 Apr 2016 11:02:15 +0100 Subject: [Haskell-cafe] SBLP 2016 Deadline Extension References: <201604090338.u393ch7J005417@easychair.org> Message-ID: We'd like to let you know that, due to multiple requests, we have extended the deadline for both abstract and paper submissions to SBLP. The new dates are the following: Abstract submission (extended!): April 22nd 2016 Paper submission (extended!): April 29th 2016 Author notification: June 10th 2016 Camera ready deadline: June 24th 2016 Please distribute the attached call for papers (with the extended deadlines) wherever you may find appropriate. Do not hesitate to contact us if you have any questions. Kind regards, Fernando Castor Yu David Liu The Brazilian Symposium on Programming Languages is a well-established symposium which provides a venue for researchers and practitioners interested in the fundamental principles and innovations in the design and implementation of programming languages and systems. SBLP 2016 will be held in Maring?, in the Southern region of Brazil, and will be the 20th edition of the symposium. SBLP is part of the 7th edition of CBSoft, the Brazilian Congress on Software: Theory and Practice. More information is available at http://cbsoft.org/sblp2016/xx-brazilian-symposium-on-programming-languages. IMPORTANT DATES Abstract submission: April 22nd 2016 Paper submission: April 29th 2016 Author notification: June 10th 2016 Camera ready deadline: June 24th 2016 Symposium dates: September 22nd and 23rd Authors are invited to submit original research on any relevant topic which can be either in the form of regular or short papers. TOPICS Topics of interest include, but are not limited to: - Program generation and transformation, including domain-specific languages, and model-driven development in the context of programming languages. - Programming paradigms and styles, including functional, object-oriented, aspect-oriented, scripting languages, real-time, service-oriented, multithreaded, parallel, and distributed programming. - Formal semantics and theoretical foundations, including denotational, operational, algebraic, and categorical. - Program analysis and verification, including type systems, static analysis, and abstract interpretation. - Programming language design and implementation, including new programming models, programming language environments, compilation, and interpretation techniques. SUBMISSION AND PUBLICATION All submissions will be peer-reviewed and judged on the basis of its originality, contribution to the field, technical and presentation quality, and relevance to the symposium. Contributions should be written in Portuguese or English. Papers should fall into one of two different categories: regular papers, which can be up to 15 pages long in LNCS format, or short papers, with up to 6 pages in LNCS format. Short papers can discuss new ideas which are at an early stage of development and which have not yet been thoroughly evaluated. We encourage the submission of short papers reporting partial results of on-going master dissertations or doctoral theses. Accepted papers written in English will be published in a volume of Lecture Notes in Computer Science (LNCS), by Springer. Both regular and short papers must be prepared using the LNCS format, available at http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0. Papers must be submitted electronically (in PDF format) via the Easychair System: http://www.easychair.org/conferences/?conf=sblp2016. As in previous editions, after the conference, authors of selected regular papers will be invited to submit an extended version of their work to be considered for publication in a journal special issue. Since 2009, selected papers of each SBPL edition are being published in a special issue of Science of Computer Programming, by Elsevier. PROGRAM CHAIRS Fernando Castor, Federal University of Pernambuco Yu David Liu, State University of New York, Binghamton PROGRAM COMMITTEE Luis Barbosa, University of Minho Thiago Tonelli Bartolomei, LogicBlox Mariza Bigonha, Federal University of Minas Gerais Roberto Bigonha, Federal University of Minas Gerais Andre Rauber Du Bois, Federal University of Pelotas Christiano Braga, Fluminense Federal University Carlos Camar?o, Federal University of Minas Gerais Francisco Carvalho-Junior, Federal University of Ceara Fernando Castor, Federal University of Pernambuco Marcelo D'Amorim, Federal University of Pernambuco Jo?o Paulo Fernandes, University of Beira Interior Jo?o Ferreira, Teesside University Lucilia Figueiredo, Federal University of Ouro Preto Ismael Figueroa, Pontificia Universidad Cat?lica de Valparaiso Alex Garcia, IME Rodrigo Geraldo, Federal University of Ouro Preto Roberto Ierusalimschy, PUC-Rio Rafael Lins, Federal University of Pernambuco Yu David Liu, State University of New York at Binghamton Hans-Wolfgang Loidl, Heriot-Watt University Marcelo Maia, Federal University of Uberl?ndia Manuel-A. Martins, University of Aveiro Fabio Mascarenhas, Federal University of Rio de Janeiro S?rgio Medeiros, Federal University of Rio Grande do Norte Ana Milanova, Rensselaer Polytechnic Institute Alvaro Moreira, Federal University of Rio Grande do Sul Martin Musicante, Federal University of Rio Grande do Norte Bruno Oliveira, The University of Hong Kong Zachary Palmer, Swarthmore College Alberto Pardo, Universidad de la Rep?blica Fernando Pereira, Federal University of Minas Gerais Gustavo Pinto, Federal Institute of Science and Technology of Para Louis-Noel Pouchet, University of California Zongyan Qiu, Peking University Sandro Rigo, State University of Campinas Noemi Rodriguez, PUC-Rio Jo?o Saraiva, University of Minho Doaitse Swierstra, Utrecht University Leopoldo Teixeira, Federal University of Pernambuco Simon Thompson, University of Kent Varmo Vene, University of Tartu From dasuraga at gmail.com Sat Apr 9 11:42:30 2016 From: dasuraga at gmail.com (Raphael Gaschignard) Date: Sat, 9 Apr 2016 20:42:30 +0900 Subject: [Haskell-cafe] Haskell, stack and the Atom editor In-Reply-To: References: Message-ID: ide-haskell has recently gotten a slack backend ( https://atom.io/packages/ide-haskell-stack). Could be worth your time. According to the ide-haskell github issue, the support is pretty "bare bones"(https://github.com/atom-haskell/ide-haskell/issues/108) but likely better than a language-agnostic linter tool On Sat, Apr 9, 2016, 6:58 PM Benjamin Edwards wrote: > > I can't stand Emacs so don't bother suggesting it. > > I guess you'll be happy to get all this stuff working on atom yourself > like the good folks working on emacs have. > > Ben > > On Sat, 9 Apr 2016 at 08:03 Thomas Koster wrote: > >> Hi friends, >> >> I want to switch to the Atom editor for my Haskell development. I have >> tried several times over the last few years and given up each time because >> hardly anything works. >> >> I can't stand Emacs so don't bother suggesting it. >> >> I am currently using Geany, which has served me well, mostly because it >> is dead simple so nothing can go wrong. In addition to the usual universal >> text editor functions, all it does is highlight syntax (albeit with an >> outdated grammar), runs custom commands to build, displays clickable errors >> in a separate pane and underlines them in the editor pane. But for larger >> projects, I want more (better autocompletion, better integration with the >> build system, better VCS support). >> >> But back to Atom, I am having extreme difficulty getting even the basics >> working. >> >> I am using GHC 7.10.2, Cabal 1.22.4.0, Stack 1.0.4. >> >> I installed Atom 1.6.1 from their deb package. >> >> I installed the "language-haskell" package. This works very well, >> thankfully, but is the *only* thing that I can get working. >> >> I avoided "ide-haskell", even though it looks great, because their readme >> says it can't build with stack and I rely heavily on stack. >> >> Instead, I installed the "build" and "linter" packages and created an >> ".atom-build" file to build my project with stack. It invokes stack >> correctly, but I can't get it to recognise any errors: linter always says >> "No issues". I must have tried twenty different regexes in "errorMatch" but >> none of them seem to work. >> >> I also installed "linter-hdevtools", hoping that that may let me see some >> errors, but I can't get that to work either. The package is loaded but it >> appears to do absolutely nothing. strace does show that Atom is trying to >> exec hdevtools through stack, but I get no output at all within Atom as >> evidence that something worked or failed. >> >> hdevtools appears to have its own problems. I had installed hdevtools >> (0.1.2.1) with stack: >> stack install hdevtools >> I ran it myself using: >> stack exec --no-ghc-package-path hdevtools -- check Main.hs >> and it gives me the infamous error: >> Cabal error: Use of GHC's environment variable GHC_PACKAGE_PATH is >> incompatible with Cabal. >> This is strange because "stack exec --no-ghc-package-path env" reports >> that no such environment variable is defined, as expected. >> >> At this point I am ready to give up yet again. Does anybody have any >> last-minute advice on using Atom to develop with Haskell and Stack? >> >> Thanks, >> Thomas Koster >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wojciech.danilo at gmail.com Sat Apr 9 15:56:14 2016 From: wojciech.danilo at gmail.com (Wojciech Danilo) Date: Sat, 09 Apr 2016 15:56:14 +0000 Subject: [Haskell-cafe] Haskell, stack and the Atom editor In-Reply-To: References: Message-ID: I'm using Atom for a week for a big commercial Haskell project. It has some minuses and the ide-haskell is not the best it could be, but it works better than any editor I've been using so far for Haskell development (mainly sublime). The type-checking, linting and error displaying inside text-editor is almost real-time on modern hardware. I've been not using emacs mostly because I prefer the sublime-like style of work. The guys behind ide-haskell seem to be pretty active and helpful and they develop it pretty fast. After installing everything ide-haskell worked out-of the box for me. sob., 9.04.2016 o 13:42 u?ytkownik Raphael Gaschignard napisa?: > ide-haskell has recently gotten a slack backend ( > https://atom.io/packages/ide-haskell-stack). Could be worth your time. > According to the ide-haskell github issue, the support is pretty "bare > bones"(https://github.com/atom-haskell/ide-haskell/issues/108) but likely > better than a language-agnostic linter tool > > On Sat, Apr 9, 2016, 6:58 PM Benjamin Edwards > wrote: > >> > I can't stand Emacs so don't bother suggesting it. >> >> I guess you'll be happy to get all this stuff working on atom yourself >> like the good folks working on emacs have. >> >> Ben >> >> On Sat, 9 Apr 2016 at 08:03 Thomas Koster wrote: >> >>> Hi friends, >>> >>> I want to switch to the Atom editor for my Haskell development. I have >>> tried several times over the last few years and given up each time because >>> hardly anything works. >>> >>> I can't stand Emacs so don't bother suggesting it. >>> >>> I am currently using Geany, which has served me well, mostly because it >>> is dead simple so nothing can go wrong. In addition to the usual universal >>> text editor functions, all it does is highlight syntax (albeit with an >>> outdated grammar), runs custom commands to build, displays clickable errors >>> in a separate pane and underlines them in the editor pane. But for larger >>> projects, I want more (better autocompletion, better integration with the >>> build system, better VCS support). >>> >>> But back to Atom, I am having extreme difficulty getting even the basics >>> working. >>> >>> I am using GHC 7.10.2, Cabal 1.22.4.0, Stack 1.0.4. >>> >>> I installed Atom 1.6.1 from their deb package. >>> >>> I installed the "language-haskell" package. This works very well, >>> thankfully, but is the *only* thing that I can get working. >>> >>> I avoided "ide-haskell", even though it looks great, because their >>> readme says it can't build with stack and I rely heavily on stack. >>> >>> Instead, I installed the "build" and "linter" packages and created an >>> ".atom-build" file to build my project with stack. It invokes stack >>> correctly, but I can't get it to recognise any errors: linter always says >>> "No issues". I must have tried twenty different regexes in "errorMatch" but >>> none of them seem to work. >>> >>> I also installed "linter-hdevtools", hoping that that may let me see >>> some errors, but I can't get that to work either. The package is loaded but >>> it appears to do absolutely nothing. strace does show that Atom is trying >>> to exec hdevtools through stack, but I get no output at all within Atom as >>> evidence that something worked or failed. >>> >>> hdevtools appears to have its own problems. I had installed hdevtools >>> (0.1.2.1) with stack: >>> stack install hdevtools >>> I ran it myself using: >>> stack exec --no-ghc-package-path hdevtools -- check Main.hs >>> and it gives me the infamous error: >>> Cabal error: Use of GHC's environment variable GHC_PACKAGE_PATH is >>> incompatible with Cabal. >>> This is strange because "stack exec --no-ghc-package-path env" reports >>> that no such environment variable is defined, as expected. >>> >>> At this point I am ready to give up yet again. Does anybody have any >>> last-minute advice on using Atom to develop with Haskell and Stack? >>> >>> Thanks, >>> Thomas Koster >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anfelor at posteo.de Sat Apr 9 19:06:39 2016 From: anfelor at posteo.de (Anton Felix Lorenzen) Date: Sat, 9 Apr 2016 21:06:39 +0200 Subject: [Haskell-cafe] Haskell, stack and the Atom editor In-Reply-To: References: Message-ID: <570952BF.6070304@posteo.de> Hello, I am using atom with ide-haskell and stack. Basically all you need is to load ghc-mod in stack: > stack install ghc-mod > stack exec atom It needs some time to build, but then it works really well. It has minor issues though: - It doesn't lookup, whether an import is legal (e.g. if the matching package is installed) - You can't trigger a build process inside atom But aside from that it is fine. I can only recommend it. Anton Felix Lorenzen From auke at tulcod.com Sat Apr 9 22:58:22 2016 From: auke at tulcod.com (Auke Booij) Date: Sat, 9 Apr 2016 23:58:22 +0100 Subject: [Haskell-cafe] Building shared library to be called from C In-Reply-To: References: Message-ID: Hi Jack, I would be interested in hearing solutions as well. The missing component is probably the HSrts-ghc library which you need to link in. Try adding -lHSrts-ghc7.10.3 to your compilation commands. Note that if you want to use preemptive threading, you should use a different RTS, hence a different library (though I'm not sure what the impact of threads launched by C code that calls your Haskell library is). I think the easiest way to set this up is using a cabal project structure. See, for example: https://github.com/nh2/call-haskell-from-anything https://github.com/abooij/sudbury https://github.com/ShabbyX/libpandoc Unfortunately, this is a bit of a hack, and in particular will not be able to install your .so library file in the correct location. (and forget about the version symlinks) And depending on other libraries (e.g. HSinteger-gmp for the integer-gmp package) is prone to breakage as the library name changes per build. (unless there is a smarter way to do this, which is why I would be interested in further replies) It looks like the cabal developers are also working on this: https://github.com/haskell/cabal/issues/141 https://github.com/haskell/cabal/pull/2540 Best of luck, Auke. On 7 April 2016 at 17:52, Jack Hill wrote: > Hi, > > I'm attempting to build a shared library that can be called from C. My end > goal is to build a PAM module, but for now I'm working with toy programs so > that I can get a feel for building how to build the library. > > The Haskell part looks like this (in a file called hfact.hs) > > module Hfact where > > import Foreign > import Foreign.C.Types > > foreign export ccall fact_hs :: CInt -> CInt > > fact :: Int -> Int > fact x = product [1..x] > > fact_hs :: CInt -> CInt > fact_hs = fromIntegral . fact . fromIntegral > > I can compile this into a so (I think successfully) with "ghc --make -shared > -dynamic -fPIC -o libhfact.so hfact.hs". > > Now I would like to be able to call this from C. I have a C program (in a > file called main.c) as follows: > > #include > #include "HsFFI.h" > #include "hfact_stub.h" > > int main(int argc, char *argv[]) { > int user, answer; > > scanf("%d", &user); > hs_init(&argc, &argv); > answer = fact_hs(user); > hs_exit(); > printf("Result: %d\n", answer); > > return 0; > } > > Unfortunately, I'm at a loss for how to build and link this against my so. > > If I try "gcc main.c -lhfact", I get many undefined symbol errors like: > > /nfshomes/j/jackhill/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/libHSbase-4.8.2.0-HQfYBxpPvuw8OunzQu6JGM-ghc7.10.3.so: > undefined reference to `__hscore_get_saved_termios' > > If I try "ghc maint.c -lhfact" I get: > > /tmp/ghc19146_0/ghc_4.o: In function `main': > ghc_3.c:(.text+0x0): multiple definition of `main' > maint.o:maint.c:(.text+0x0): first defined here > /tmp/ghc19146_0/ghc_4.o: In function `main': > ghc_3.c:(.text+0x61): undefined reference to `ZCMain_main_closure' > collect2: error: ld returned 1 exit status > > How should I be calling Haskell from C? > > Best, > Jack > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From tkoster at gmail.com Sun Apr 10 01:59:10 2016 From: tkoster at gmail.com (Thomas Koster) Date: Sun, 10 Apr 2016 11:59:10 +1000 Subject: [Haskell-cafe] Haskell, stack and the Atom editor In-Reply-To: References: Message-ID: Benjamin, On 9 April 2016 at 17:03, Thomas Koster wrote: > I want to switch to the Atom editor for my Haskell development. I have tried > several times over the last few years and given up each time because hardly > anything works. > > I can't stand Emacs so don't bother suggesting it. On 9 April 2016 at 19:57, Benjamin Edwards wrote: > I guess you'll be happy to get all this stuff working on atom yourself like > the good folks working on emacs have. No. Not happy at all. I spent only minutes setting up Geany for Haskell development. Basically, bind some ghc-mod commands and stack commands to hotkeys. Sure, it doesn't do much, but the basics work beautifully for small projects. This is my benchmark. Because that was all it took to get Geany to build my projects, I took the same approach with Atom. But I have wasted hours on Atom so far and didn't get further than syntax highlighting. So while I admit this was clearly the wrong approach, I am still displeased with Atom right now. But I wasted days once trying to learn Emacs. Sorry, I just don't have the time or brain-space to attempt Emacs again. Certainly, the haskell-mode team are to be congratulated for what is probably the most mature and feature-rich Haskell IDE offering we have at this time. I just find it tragic that it targets Emacs. If I can't make Atom work for me, I will drop it just as fast as I dropped Emacs. Spacemacs was suggested to me off-list; if it addresses my complaints about Emacs, I might give it a chance. But Atom is the topic of this thread, so lest this thread descend into a text editor flame war, I suggest we stop talking about Emacs (or Vim, or Eclipse, or anything else). -- Thomas Koster From tkoster at gmail.com Sun Apr 10 02:46:59 2016 From: tkoster at gmail.com (Thomas Koster) Date: Sun, 10 Apr 2016 12:46:59 +1000 Subject: [Haskell-cafe] Haskell, stack and the Atom editor In-Reply-To: <570952BF.6070304@posteo.de> References: <570952BF.6070304@posteo.de> Message-ID: On 9 April 2016 at 17:03, Thomas Koster wrote: > I want to switch to the Atom editor for my Haskell development. I have tried > several times over the last few years and given up each time because hardly > anything works. > > At this point I am ready to give up yet again. Does anybody have any > last-minute advice on using Atom to develop with Haskell and Stack? On 9 April 2016 at 21:42, Raphael Gaschignard wrote: > ide-haskell has recently gotten a slack backend > (https://atom.io/packages/ide-haskell-stack). Could be worth your time. > According to the ide-haskell github issue, the support is pretty "bare > bones"(https://github.com/atom-haskell/ide-haskell/issues/108) but likely > better than a language-agnostic linter tool On 10 April 2016 at 01:56, Wojciech Danilo wrote: > I'm using Atom for a week for a big commercial Haskell project. It has some > minuses and the ide-haskell is not the best it could be, but it works better > than any editor I've been using so far for Haskell development (mainly > sublime). The type-checking, linting and error displaying inside text-editor > is almost real-time on modern hardware. I've been not using emacs mostly > because I prefer the sublime-like style of work. The guys behind ide-haskell > seem to be pretty active and helpful and they develop it pretty fast. After > installing everything ide-haskell worked out-of the box for me. On 10 April 2016 at 05:06, Anton Felix Lorenzen wrote: > I am using atom with ide-haskell and stack. > Basically all you need is to load ghc-mod in stack: >> stack install ghc-mod >> stack exec atom > > It needs some time to build, but then it works really well. > It has minor issues though: > - It doesn't lookup, whether an import is legal > (e.g. if the matching package is installed) > - You can't trigger a build process inside atom > > But aside from that it is fine. > I can only recommend it. Thanks Raphael, Wojciech and Anton. I tried out ide-haskell with the ide-haskell-stack backend. Everything seems to be working well enough to give it a go for my next project. However, type-checking, linting and error display inside the editor is far from real-time for me (never < 1s), but they never were for me, so I don't think that has anything to do with Atom. -- Thomas Koster From rustompmody at gmail.com Sun Apr 10 07:36:20 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Sun, 10 Apr 2016 13:06:20 +0530 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) Message-ID: On Sun, Apr 10, 2016 at 7:29 AM, Thomas Koster wrote: > > If I can't make Atom work for me, I will drop it just as fast as I > dropped Emacs. Spacemacs was suggested to me off-list; if it addresses > my complaints about Emacs, I might give it a chance. But Atom is the > topic of this thread, so lest this thread descend into a text editor > flame war, I suggest we stop talking about Emacs (or Vim, or Eclipse, > or anything else). > > [Note the changed subject line :-) ] Ive been having a great deal of confusion/trouble with emacs haskell-mode of late. No this is not a gripe about haskell-mode Just that I find myself confused over 1. The old comint interface and new ? one -- when does which kick in 2. Basic setups -- is it called haskell-mode/haskell-emacs or what? 3. I dont quite know when things stopped working/being comfortable/familiar but I remember it as having nothing to do with haskell -- updating org mode or some such Just that I am supposed to be (at least out here!!) an emacs and haskell expert and while showing others how to get started I am often finding my own setups embarrassingly broken Any tips for an old emacs-geezer? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Sun Apr 10 08:43:31 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Sun, 10 Apr 2016 18:43:31 +1000 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: On 10 April 2016 at 17:36, Rustom Mody wrote: > On Sun, Apr 10, 2016 at 7:29 AM, Thomas Koster wrote: >> >> >> If I can't make Atom work for me, I will drop it just as fast as I >> dropped Emacs. Spacemacs was suggested to me off-list; if it addresses >> my complaints about Emacs, I might give it a chance. But Atom is the >> topic of this thread, so lest this thread descend into a text editor >> flame war, I suggest we stop talking about Emacs (or Vim, or Eclipse, >> or anything else). >> > > [Note the changed subject line :-) ] > > Ive been having a great deal of confusion/trouble with emacs haskell-mode of > late. > No this is not a gripe about haskell-mode > Just that I find myself confused over > > The old comint interface and new ? one -- when does which kick in I don't think the old comint interface is used at all any more (but may still be present for backwards-compatibility). > Basic setups -- is it called haskell-mode/haskell-emacs or what? haskell-emacs was Chris Done's first attempt at writing a new Haskell mdoe for Emacs before he merged it into haskell-mode proper; so you probably don't want to use haskell-emacs any more (it's rather old and quite probably bitrotted). > I dont quite know when things stopped working/being comfortable/familiar but > I remember it as having nothing to do with haskell -- updating org mode or > some such ? org-mode can be a pain to upgrade due to compilations trying to use already loaded/present versions, but installing haskell-mode via package.el is rather easy. > Just that I am supposed to be (at least out here!!) an emacs and haskell > expert and while showing others how to get started I am often finding my own > setups embarrassingly broken > > Any tips for an old emacs-geezer? Chris Done has a sample config: https://github.com/chrisdone/emacs-haskell-config/ -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From rustompmody at gmail.com Sun Apr 10 09:25:17 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Sun, 10 Apr 2016 14:55:17 +0530 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: On Sun, Apr 10, 2016 at 2:13 PM, Ivan Lazar Miljenovic < ivan.miljenovic at gmail.com> wrote: > On 10 April 2016 at 17:36, Rustom Mody wrote: > > > Basic setups -- is it called haskell-mode/haskell-emacs or what? > > haskell-emacs was Chris Done's first attempt at writing a new Haskell > mdoe for Emacs before he merged it into haskell-mode proper; so you > probably don't want to use haskell-emacs any more (it's rather old and > quite probably bitrotted). > Just tried the "Quick Install" instructions at https://github.com/haskell/haskell-mode As best as I can see there is no haskell-mode after package-refresh contents There is only these when I try to do package-install [completions buffer] Click on a completion to select it. In this buffer, type RET to select the completion near point. Possible completions are: haskell-emacs haskell-emacs-base haskell-emacs-text haskell-snippets haskell-tab-indent -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Sun Apr 10 10:35:54 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Sun, 10 Apr 2016 16:05:54 +0530 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: On Sun, Apr 10, 2016 at 2:55 PM, Rustom Mody wrote: > On Sun, Apr 10, 2016 at 2:13 PM, Ivan Lazar Miljenovic < > ivan.miljenovic at gmail.com> wrote: > >> On 10 April 2016 at 17:36, Rustom Mody wrote: >> >> > Basic setups -- is it called haskell-mode/haskell-emacs or what? >> >> haskell-emacs was Chris Done's first attempt at writing a new Haskell >> mdoe for Emacs before he merged it into haskell-mode proper; so you >> probably don't want to use haskell-emacs any more (it's rather old and >> quite probably bitrotted). >> > > Just tried the "Quick Install" instructions at > https://github.com/haskell/haskell-mode > As best as I can see there is no haskell-mode after package-refresh > contents > There is only these when I try to do package-install [completions buffer] > > Click on a completion to select it. > In this buffer, type RET to select the completion near point. > > Possible completions are: > haskell-emacs haskell-emacs-base > haskell-emacs-text haskell-snippets > haskell-tab-indent > Update: While the install via emacs package system doesn't work, install via git does Emacs package system is about as broken as a linux kernel would be if it tried to do the job of grub -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexey.raga at gmail.com Sun Apr 10 12:09:06 2016 From: alexey.raga at gmail.com (Alexey Raga) Date: Sun, 10 Apr 2016 05:09:06 -0700 (PDT) Subject: [Haskell-cafe] C2HS - marchalling arrays Message-ID: <8af8040a-ba5b-4873-a2b8-b1b260c1939a@googlegroups.com> Hi, I am using c2hs and I want to create bindings for a C function with the following signature: my_function(my_struct_t*, int* values, size_t num_values); Ideally I'd like to have a function that accepts [CInt], not a pair (pointer, size). What is the easiest way to do it? Can c2hs help me with this or I need to do it manually? Regards, Alexey. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Sun Apr 10 13:02:23 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Sun, 10 Apr 2016 23:02:23 +1000 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: On 10 April 2016 at 20:35, Rustom Mody wrote: > > > On Sun, Apr 10, 2016 at 2:55 PM, Rustom Mody wrote: >> >> On Sun, Apr 10, 2016 at 2:13 PM, Ivan Lazar Miljenovic >> wrote: >>> >>> On 10 April 2016 at 17:36, Rustom Mody wrote: >>> >>> > Basic setups -- is it called haskell-mode/haskell-emacs or what? >>> >>> haskell-emacs was Chris Done's first attempt at writing a new Haskell >>> mdoe for Emacs before he merged it into haskell-mode proper; so you >>> probably don't want to use haskell-emacs any more (it's rather old and >>> quite probably bitrotted). >> >> >> Just tried the "Quick Install" instructions at >> https://github.com/haskell/haskell-mode >> As best as I can see there is no haskell-mode after package-refresh >> contents >> There is only these when I try to do package-install [completions buffer] >> >> Click on a completion to select it. >> In this buffer, type RET to select the completion near point. >> >> Possible completions are: >> haskell-emacs haskell-emacs-base >> haskell-emacs-text haskell-snippets >> haskell-tab-indent > > > > Update: > While the install via emacs package system doesn't work, install via git > does > > > Emacs package system is about as broken as a linux kernel would be if it > tried to do the job of grub > > Can you double check whether melpa-stable was indeed added to package-archives? (That said, I use melpa itself rather than melpa-stable to get regular snapshots rather than specific releases.) Another alternative is to use el-get to fetch it from git rather than package.el. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From rustompmody at gmail.com Sun Apr 10 13:40:20 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Sun, 10 Apr 2016 19:10:20 +0530 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: On Sun, Apr 10, 2016 at 6:32 PM, Ivan Lazar Miljenovic < ivan.miljenovic at gmail.com> wrote: > On 10 April 2016 at 20:35, Rustom Mody wrote: > > > > > > On Sun, Apr 10, 2016 at 2:55 PM, Rustom Mody > wrote: > >> > >> On Sun, Apr 10, 2016 at 2:13 PM, Ivan Lazar Miljenovic > >> wrote: > >>> > >>> On 10 April 2016 at 17:36, Rustom Mody wrote: > >>> > >>> > Basic setups -- is it called haskell-mode/haskell-emacs or what? > >>> > >>> haskell-emacs was Chris Done's first attempt at writing a new Haskell > >>> mdoe for Emacs before he merged it into haskell-mode proper; so you > >>> probably don't want to use haskell-emacs any more (it's rather old and > >>> quite probably bitrotted). > >> > >> > >> Just tried the "Quick Install" instructions at > >> https://github.com/haskell/haskell-mode > >> As best as I can see there is no haskell-mode after package-refresh > >> contents > >> There is only these when I try to do package-install [completions > buffer] > >> > >> Click on a completion to select it. > >> In this buffer, type RET to select the completion near point. > >> > >> Possible completions are: > >> haskell-emacs haskell-emacs-base > >> haskell-emacs-text haskell-snippets > >> haskell-tab-indent > > > > > > > > Update: > > While the install via emacs package system doesn't work, install via git > > does > > > > > > Emacs package system is about as broken as a linux kernel would be if it > > tried to do the job of grub > > > > > > Can you double check whether melpa-stable was indeed added to > package-archives? (That said, I use melpa itself rather than > melpa-stable to get regular snapshots rather than specific releases.) > > Another alternative is to use el-get to fetch it from git rather than > package.el. > > Changing the melpa url from http to https seems to make it work -- thanks! [Instructions here https://github.com/haskell/haskell-mode give http] I'll need to check more carefully -------------- next part -------------- An HTML attachment was scrubbed... URL: From gracjanpolak at gmail.com Sun Apr 10 13:59:22 2016 From: gracjanpolak at gmail.com (Gracjan Polak) Date: Sun, 10 Apr 2016 13:59:22 +0000 (UTC) Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) References: Message-ID: Rustom Mody gmail.com> writes: > Changing the melpa url from http to https seems to make it work -- thanks! > > [Instructions here https://github.com/haskell/haskell-mode give http] > > I'll need to check more carefully Plain http works for me. -- Gracjan From gracjanpolak at gmail.com Sun Apr 10 14:03:33 2016 From: gracjanpolak at gmail.com (Gracjan Polak) Date: Sun, 10 Apr 2016 14:03:33 +0000 (UTC) Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) References: Message-ID: Rustom Mody gmail.com> writes: > The old comint interface and new ? one -- when does which kick in There are quite some people out there using inf-haskell (comint) and larger number of interactive-haskell-mode users. Note that haskell-mode project is a bin for many projects that used to be unrelated, hence there is quite some functionality duplication. We are working on solving most annoying sources of confusion. > Basic setups -- is it called haskell-mode/haskell-emacs or what? haskell-mode or even Haskell Mode these days. haskell-emacs is something completly unrelated (write Emacs extensions in Haskell). > I dont quite know when things stopped working/being comfortable/familiar but I remember it as having nothing to do with haskell -- updating org mode or some such I never had issues with org-mode so can't help you there. > > Just that I am supposed to be (at least out here!!) an emacs and haskell expert and while showing others how to get started I am often finding my own setups embarrassingly brokenAny tips for an old emacs-geezer? What do you mean? You install and it works. Even configuration step is optional as we try to provide sane defaults and sane keybindings. -- Gracjan From tomas.carnecky at gmail.com Sun Apr 10 15:40:30 2016 From: tomas.carnecky at gmail.com (Tomas Carnecky) Date: Sun, 10 Apr 2016 15:40:30 +0000 Subject: [Haskell-cafe] Haskell on OpenWRT In-Reply-To: <20160409084618.4378706.35395.3068@amok.cc> References: <5708B534.9010109@funwithsoftware.org> <20160409084618.4378706.35395.3068@amok.cc> Message-ID: I was able to compile Haskell for a mips-linux-musl target ( https://onion.io/omega). Most problems were due to the different architecture (MIPS) than musl. Once you have a C cross-compiler (I used http://crosstool-ng.org/ to built the cross-compiler toolchain), compiling GHC as a cross compiler for that target and then a Haskell application shouldn't be a problem. If you have enough disk space on the target, I would suggest that you compile your Haskell application into a static binary. On Sat, Apr 9, 2016 at 10:47 AM Lana Black wrote: > You will probably have better luck using ghc with musl?. > > Check out this thread: ? > https://mail.haskell.org/pipermail/haskell-cafe/2015-May/119843.html > > Original Message > From: Patrick Pelletier > Sent: Saturday, April 9, 2016 7:54 AM > To: haskell-cafe > Subject: [Haskell-cafe] Haskell on OpenWRT > > Has anyone had any success running Haskell programs on OpenWRT? > > Specifically, I'm running OpenWRT on x86_64, so processor architecture > shouldn't be an issue. However, by default OpenWRT uses musl as its C > library, so binaries from a "normal" Linux system wouldn't be compatible > with OpenWRT. > > I attempted to get around this problem by building an OpenWRT image with > glibc as the C library. In theory, that ought to solve the problem. In > practice, my program (a simple hello-world type program, which runs fine > on Ubuntu) hung, printing nothing, using nearly all of one core, and was > unkillable by any signal other than SIGKILL. If left alone to run, it > eventually used all available memory and then died. > > I took a look at ldd, to see if there were any clues there. On my > Ubuntu 12.04 machine, where I compiled the program (using ghc 7.4.1), I > get: > > ppelletier at patrick64:~/programming/haskell$ ldd contact > linux-vdso.so.1 => (0x00007fff36f50000) > libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 > (0x00007f8d49cf8000) > libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 > (0x00007f8d49af0000) > libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8d497f3000) > librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8d495eb000) > libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8d493e7000) > libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8d49028000) > libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 > (0x00007f8d48e0b000) > /lib64/ld-linux-x86-64.so.2 (0x00007f8d49f8d000) > > On my OpenWRT (trunk) box, I get: > > root at OpenWrt:~# ldd /tmp/contact > linux-vdso.so.1 (0x00007ffd2afcc000) > libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007f27a057a000) > libffi.so.6 => /usr/lib/libffi.so.6 (0x00007f27a0373000) > libm.so.6 => /lib/libm.so.6 (0x00007f27a0080000) > librt.so.1 => /lib/librt.so.1 (0x00007f279fe79000) > libdl.so.2 => /lib/libdl.so.2 (0x00007f279fc76000) > libc.so.6 => /lib/libc.so.6 (0x00007f279f906000) > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f279f6f4000) > libpthread.so.0 => /lib/libpthread.so.0 (0x00007f279f4d9000) > /lib64/ld-linux-x86-64.so.2 (0x00007f27a07dc000) > > This is almost the same, except it has "libgcc_s.so.1", while on the > Ubuntu box it does not. > > I'd welcome any ideas on how to solve (or at least diagnose) this > problem. I'd also be interested in any thoughts on the broader question > of running Haskell programs on OpenWRT. > > Thanks, > > --Patrick > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Sun Apr 10 19:57:23 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Sun, 10 Apr 2016 12:57:23 -0700 Subject: [Haskell-cafe] Haskell on OpenWRT In-Reply-To: References: <5708B534.9010109@funwithsoftware.org> <20160409084618.4378706.35395.3068@amok.cc> Message-ID: <570AB023.1010900@funwithsoftware.org> Thanks! I'll take a look at building a cross-compiler, since it worked out for you. I'd been a little afraid to try. (I previously had a bad experience building ghc as a cross-compiler, but that was with Android as the target and Mac OS X as the host. The issues I encountered were mostly when it tried to link ELF binaries with the Mach-O linker, or vice versa. But with both host and target being Linux, the linker issues can probably be swept under the rug.) The C cross compiler shouldn't be a problem, since OpenWRT's "buildroot" builds a cross-compiler automatically. (Though if for any reason that turns out to be a problem, thanks for the tip about crosstool-ng.) Ideally, I'd love to integrate ghc into OpenWRT's buildroot so that packages written in Haskell could be built as easily and in the same way as packages written in C. But I still have a lot to learn before I attempt that. My boot device is an SD card, so space for static binaries shouldn't be a problem. I already have several gigabytes, which should be more than enough, and if for some reason I needed more space, I could swap in a larger SD card, or add more space via USB or mSATA. I was aware of Marios Titas's "GHC + musl = easier static linking", but wasn't really thrilled at the idea of needing an install of Gentoo-musl to host it. (But I can certainly try that if I have to.) Or I could just use my OpenWRT box to host the GHC-musl, but I'm running into issues with getting gcc to run on the target, which I'm currently following up with the OpenWRT community. Thanks for the ideas! I'm sure that one way or another I'll be able to get it working. --Patrick On 4/10/16 8:40 AM, Tomas Carnecky wrote: > I was able to compile Haskell for a mips-linux-musl target > (https://onion.io/omega). Most problems were due to the different > architecture (MIPS) than musl. Once you have a C cross-compiler (I > used http://crosstool-ng.org/ to built the cross-compiler toolchain), > compiling GHC as a cross compiler for that target and then a Haskell > application shouldn't be a problem. > > If you have enough disk space on the target, I would suggest that you > compile your Haskell application into a static binary. > > On Sat, Apr 9, 2016 at 10:47 AM Lana Black wrote: > > You will probably have better luck using ghc with musl?. > > Check out this thread: > ?https://mail.haskell.org/pipermail/haskell-cafe/2015-May/119843.html > > Original Message > From: Patrick Pelletier > Sent: Saturday, April 9, 2016 7:54 AM > To: haskell-cafe > Subject: [Haskell-cafe] Haskell on OpenWRT > > Has anyone had any success running Haskell programs on OpenWRT? > > Specifically, I'm running OpenWRT on x86_64, so processor architecture > shouldn't be an issue. However, by default OpenWRT uses musl as its C > library, so binaries from a "normal" Linux system wouldn't be > compatible > with OpenWRT. > > I attempted to get around this problem by building an OpenWRT > image with > glibc as the C library. In theory, that ought to solve the problem. In > practice, my program (a simple hello-world type program, which > runs fine > on Ubuntu) hung, printing nothing, using nearly all of one core, > and was > unkillable by any signal other than SIGKILL. If left alone to run, it > eventually used all available memory and then died. > > I took a look at ldd, to see if there were any clues there. On my > Ubuntu 12.04 machine, where I compiled the program (using ghc > 7.4.1), I get: > > ppelletier at patrick64:~/programming/haskell$ ldd contact > linux-vdso.so.1 => (0x00007fff36f50000) > libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 > (0x00007f8d49cf8000) > libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 > (0x00007f8d49af0000) > libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8d497f3000) > librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8d495eb000) > libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8d493e7000) > libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8d49028000) > libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 > (0x00007f8d48e0b000) > /lib64/ld-linux-x86-64.so.2 (0x00007f8d49f8d000) > > On my OpenWRT (trunk) box, I get: > > root at OpenWrt:~# ldd /tmp/contact > linux-vdso.so.1 (0x00007ffd2afcc000) > libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007f27a057a000) > libffi.so.6 => /usr/lib/libffi.so.6 (0x00007f27a0373000) > libm.so.6 => /lib/libm.so.6 (0x00007f27a0080000) > librt.so.1 => /lib/librt.so.1 (0x00007f279fe79000) > libdl.so.2 => /lib/libdl.so.2 (0x00007f279fc76000) > libc.so.6 => /lib/libc.so.6 (0x00007f279f906000) > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f279f6f4000) > libpthread.so.0 => /lib/libpthread.so.0 (0x00007f279f4d9000) > /lib64/ld-linux-x86-64.so.2 (0x00007f27a07dc000) > > This is almost the same, except it has "libgcc_s.so.1", while on the > Ubuntu box it does not. > > I'd welcome any ideas on how to solve (or at least diagnose) this > problem. I'd also be interested in any thoughts on the broader > question > of running Haskell programs on OpenWRT. > > Thanks, > > --Patrick > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomas.carnecky at gmail.com Sun Apr 10 20:03:42 2016 From: tomas.carnecky at gmail.com (Tomas Carnecky) Date: Sun, 10 Apr 2016 20:03:42 +0000 Subject: [Haskell-cafe] Haskell on OpenWRT In-Reply-To: <570AB023.1010900@funwithsoftware.org> References: <5708B534.9010109@funwithsoftware.org> <20160409084618.4378706.35395.3068@amok.cc> <570AB023.1010900@funwithsoftware.org> Message-ID: Mac OS X as the host is unbelievably painful. It's easier to have the host and target be the same OS (linux + linux). You don't need a full system (gentoo) to use GHC + musl in static linking mode. Just an appropriate cross-compiler toolchain. crosstools-ng can be configured so that the compiler always produces a static build (run ct-ng menuconfig, and look through the options. The UI should be familiar if you've ever used the Linux kernel menuconfig facility). On Sun, Apr 10, 2016 at 9:57 PM Patrick Pelletier wrote: > Thanks! I'll take a look at building a cross-compiler, since it worked > out for you. I'd been a little afraid to try. (I previously had a bad > experience building ghc as a cross-compiler, but that was with Android as > the target and Mac OS X as the host. The issues I encountered were mostly > when it tried to link ELF binaries with the Mach-O linker, or vice versa. > But with both host and target being Linux, the linker issues can probably > be swept under the rug.) > > The C cross compiler shouldn't be a problem, since OpenWRT's "buildroot" > builds a cross-compiler automatically. (Though if for any reason that > turns out to be a problem, thanks for the tip about crosstool-ng.) > Ideally, I'd love to integrate ghc into OpenWRT's buildroot so that > packages written in Haskell could be built as easily and in the same way as > packages written in C. But I still have a lot to learn before I attempt > that. > > My boot device is an SD card, so space for static binaries shouldn't be a > problem. I already have several gigabytes, which should be more than > enough, and if for some reason I needed more space, I could swap in a > larger SD card, or add more space via USB or mSATA. > > I was aware of Marios Titas's "GHC + musl = easier static linking", but > wasn't really thrilled at the idea of needing an install of Gentoo-musl to > host it. (But I can certainly try that if I have to.) Or I could just use > my OpenWRT box to host the GHC-musl, but I'm running into issues with > getting gcc to run on the target, which I'm currently following up with the > OpenWRT community. > > Thanks for the ideas! I'm sure that one way or another I'll be able to > get it working. > > > --Patrick > > > > On 4/10/16 8:40 AM, Tomas Carnecky wrote: > > I was able to compile Haskell for a mips-linux-musl target ( > https://onion.io/omega). Most problems were due to the different > architecture (MIPS) than musl. Once you have a C cross-compiler (I used > http://crosstool-ng.org/ to built the > cross-compiler toolchain), compiling GHC as a cross compiler for that > target and then a Haskell application shouldn't be a problem. > > If you have enough disk space on the target, I would suggest that you > compile your Haskell application into a static binary. > > On Sat, Apr 9, 2016 at 10:47 AM Lana Black > wrote: > >> You will probably have better luck using ghc with musl?. >> >> Check out this thread: ? >> https://mail.haskell.org/pipermail/haskell-cafe/2015-May/119843.html >> >> Original Message >> From: Patrick Pelletier >> Sent: Saturday, April 9, 2016 7:54 AM >> To: haskell-cafe >> Subject: [Haskell-cafe] Haskell on OpenWRT >> >> Has anyone had any success running Haskell programs on OpenWRT? >> >> Specifically, I'm running OpenWRT on x86_64, so processor architecture >> shouldn't be an issue. However, by default OpenWRT uses musl as its C >> library, so binaries from a "normal" Linux system wouldn't be compatible >> with OpenWRT. >> >> I attempted to get around this problem by building an OpenWRT image with >> glibc as the C library. In theory, that ought to solve the problem. In >> practice, my program (a simple hello-world type program, which runs fine >> on Ubuntu) hung, printing nothing, using nearly all of one core, and was >> unkillable by any signal other than SIGKILL. If left alone to run, it >> eventually used all available memory and then died. >> >> I took a look at ldd, to see if there were any clues there. On my >> Ubuntu 12.04 machine, where I compiled the program (using ghc 7.4.1), I >> get: >> >> ppelletier at patrick64:~/programming/haskell$ ldd contact >> linux-vdso.so.1 => (0x00007fff36f50000) >> libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 >> (0x00007f8d49cf8000) >> libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 >> (0x00007f8d49af0000) >> libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8d497f3000) >> librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8d495eb000) >> libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8d493e7000) >> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8d49028000) >> libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 >> (0x00007f8d48e0b000) >> /lib64/ld-linux-x86-64.so.2 (0x00007f8d49f8d000) >> >> On my OpenWRT (trunk) box, I get: >> >> root at OpenWrt:~# ldd /tmp/contact >> linux-vdso.so.1 (0x00007ffd2afcc000) >> libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007f27a057a000) >> libffi.so.6 => /usr/lib/libffi.so.6 (0x00007f27a0373000) >> libm.so.6 => /lib/libm.so.6 (0x00007f27a0080000) >> librt.so.1 => /lib/librt.so.1 (0x00007f279fe79000) >> libdl.so.2 => /lib/libdl.so.2 (0x00007f279fc76000) >> libc.so.6 => /lib/libc.so.6 (0x00007f279f906000) >> libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f279f6f4000) >> libpthread.so.0 => /lib/libpthread.so.0 (0x00007f279f4d9000) >> /lib64/ld-linux-x86-64.so.2 (0x00007f27a07dc000) >> >> This is almost the same, except it has "libgcc_s.so.1", while on the >> Ubuntu box it does not. >> >> I'd welcome any ideas on how to solve (or at least diagnose) this >> problem. I'd also be interested in any thoughts on the broader question >> of running Haskell programs on OpenWRT. >> >> Thanks, >> >> --Patrick >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Sun Apr 10 20:52:07 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Sun, 10 Apr 2016 13:52:07 -0700 Subject: [Haskell-cafe] Haskell on OpenWRT In-Reply-To: References: <5708B534.9010109@funwithsoftware.org> <20160409084618.4378706.35395.3068@amok.cc> <570AB023.1010900@funwithsoftware.org> Message-ID: <570ABCF7.30202@funwithsoftware.org> On 4/10/16 1:03 PM, Tomas Carnecky wrote: > You don't need a full system (gentoo) to use GHC + musl in static > linking mode. Just an appropriate cross-compiler toolchain. Yeah, sorry, I was replying to both your suggestion and Lana's suggestion in a single email, but I didn't make that clear. You had suggested the cross-compiler, while she suggested Marios Titas's build of GHC, which is not a cross-compiler, and therefore does need a musl host system. Marios's email had made it sound like using a ghc cross-compiler was difficult, which is why he'd provided the musl-hosted compiler. But since you had good luck with the cross-compiler, I'll give the cross-compiler a try. > crosstools-ng can be configured so that the compiler always produces a > static build (run ct-ng menuconfig, and look through the options. The > UI should be familiar if you've ever used the Linux kernel menuconfig > facility). Yes, OpenWRT buildroot uses the same "make menuconfig" facility. I'll still probably try OpenWRT's cross toolchain first, since it's already built and sitting in the buildroot on my host system. But crosstools-ng sounds like a good fallback. Sorry for the confusion, --Patrick From rustompmody at gmail.com Mon Apr 11 05:03:13 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Mon, 11 Apr 2016 10:33:13 +0530 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: On Sun, Apr 10, 2016 at 7:33 PM, Gracjan Polak wrote: > Rustom Mody gmail.com> writes: > > > The old comint interface and new ? one -- when does which kick in > > There are quite some people out there using inf-haskell (comint) and larger > number of interactive-haskell-mode users. > 1. Start in a foo.hs file 2. Load file 3. I get the lambda interface Instead M-x run-haskell I get old interface How do I get one uniform interface? -------------- next part -------------- An HTML attachment was scrubbed... URL: From _deepfire at feelingofgreen.ru Mon Apr 11 07:57:20 2016 From: _deepfire at feelingofgreen.ru (Kosyrev Serge) Date: Mon, 11 Apr 2016 10:57:20 +0300 Subject: [Haskell-cafe] MPTC and quantification in GADTs vs. regular ADTs Message-ID: <87lh4kbmsf.fsf@andromedae.feelingofgreen.ru> Good day folks! What is the explanation for the difference in GHC reaction towards the two variants of the following piece of code: > {-# LANGUAGE GADTs #-} > {-# LANGUAGE RankNTypes #-} > {-# LANGUAGE RecordWildCards #-} > {-# LANGUAGE MultiParamTypeClasses #-} > {-# LANGUAGE UnicodeSyntax #-} > > import Prelude.Unicode > > class MPTC row col where > class TC a where > method ? a ? a > 1 data T row col where 1 T ? ? row col. MPTC row col ? 1 { col ? col 1 , row ? row } ? T row col 2 data T row col 2 = ? row col. MPTC row col ? 2 T { col ? col 2 , row ? row } > > instance MPTC row col ? TC (T row col) where > method w at T{..} = > seq (recover (toCol w) row) w > > toCol ? MPTC row col ? T row col ? col > toCol = (?) > > recover ? MPTC row col ? col ? row ? T row col > recover = T Note the missing > instance MPTC row col Nevertheless, the former typechecks, while the latter is rejected with: > mptc-data-vs-gadt.hs:23:14-34: error: ? > ? Could not deduce (MPTC row1 col) arising from a use of ?recover? > from the context: MPTC row col > bound by the instance declaration > at mptc-data-vs-gadt.hs:21:10-38 > or from: MPTC row1 col1 > bound by a pattern with constructor: > T :: forall row col row col. > MPTC row col => > col -> row -> T row col, > in an equation for ?method? > at mptc-data-vs-gadt.hs:22:14-18 > Possible fix: > add (MPTC row1 col) to the context of the data constructor ?T? > ? In the expression: (recover (toCol w) row) > In the expression: seq (recover (toCol w) row) w > In an equation for ?method?: > method w@(T {..}) = seq (recover (toCol w) row) w I'm sure this must have something to do with GADTs carrying type equality constraints, but still I don't quite understand the difference in interpretation of the forall quantification. To my understanding, a value bound by the pattern 'w at T{..}' ought to be treated as sufficient evidence for 'MPTC row col', no matter whether it is a GADT or not. ..but it isn't. -- ? ???????e? / respectfully, ??????? ?????? From oleg.grenrus at iki.fi Mon Apr 11 08:25:30 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Mon, 11 Apr 2016 11:25:30 +0300 Subject: [Haskell-cafe] MPTC and quantification in GADTs vs. regular ADTs In-Reply-To: <87lh4kbmsf.fsf@andromedae.feelingofgreen.ru> References: <87lh4kbmsf.fsf@andromedae.feelingofgreen.ru> Message-ID: <612905B3-784C-458A-A71C-DF4339DB3ED5@iki.fi> If you change latter definition to data T row col = MPTC row col => T { col :: col , row :: row } I.e. remove `forall row col`, then everything starts to work. As your definition is (with unique names) is: data T anyrow anycol = forall row col. MPTC row col => T { col :: col , row :: row } i.e. the indexes are phantom and field types are existential. In the first version, the `forall row col` is harmless, as the indexes are repeated in GADT syntax: -> T row col - Oleg > On 11 Apr 2016, at 10:57, Kosyrev Serge <_deepfire at feelingofgreen.ru> wrote: > > Good day folks! > > What is the explanation for the difference in GHC reaction towards the > two variants of the following piece of code: > >> {-# LANGUAGE GADTs #-} >> {-# LANGUAGE RankNTypes #-} >> {-# LANGUAGE RecordWildCards #-} >> {-# LANGUAGE MultiParamTypeClasses #-} >> {-# LANGUAGE UnicodeSyntax #-} >> >> import Prelude.Unicode >> >> class MPTC row col where >> class TC a where >> method ? a ? a >> > 1 data T row col where > 1 T ? ? row col. MPTC row col ? > 1 { col ? col > 1 , row ? row } ? T row col > 2 data T row col > 2 = ? row col. MPTC row col ? > 2 T { col ? col > 2 , row ? row } >> >> instance MPTC row col ? TC (T row col) where >> method w at T{..} = >> seq (recover (toCol w) row) w >> >> toCol ? MPTC row col ? T row col ? col >> toCol = (?) >> >> recover ? MPTC row col ? col ? row ? T row col >> recover = T > > Note the missing > >> instance MPTC row col > > Nevertheless, the former typechecks, while the latter is rejected with: > >> mptc-data-vs-gadt.hs:23:14-34: error: ? >> ? Could not deduce (MPTC row1 col) arising from a use of ?recover? >> from the context: MPTC row col >> bound by the instance declaration >> at mptc-data-vs-gadt.hs:21:10-38 >> or from: MPTC row1 col1 >> bound by a pattern with constructor: >> T :: forall row col row col. >> MPTC row col => >> col -> row -> T row col, >> in an equation for ?method? >> at mptc-data-vs-gadt.hs:22:14-18 >> Possible fix: >> add (MPTC row1 col) to the context of the data constructor ?T? >> ? In the expression: (recover (toCol w) row) >> In the expression: seq (recover (toCol w) row) w >> In an equation for ?method?: >> method w@(T {..}) = seq (recover (toCol w) row) w > > I'm sure this must have something to do with GADTs carrying type > equality constraints, but still I don't quite understand the difference > in interpretation of the forall quantification. > > To my understanding, a value bound by the pattern 'w at T{..}' ought to be > treated as sufficient evidence for 'MPTC row col', no matter whether > it is a GADT or not. > > ..but it isn't. > > -- > ? ???????e? / respectfully, > ??????? ?????? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From ivan.miljenovic at gmail.com Mon Apr 11 11:49:55 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Mon, 11 Apr 2016 21:49:55 +1000 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: On 11 April 2016 at 15:03, Rustom Mody wrote: > > > On Sun, Apr 10, 2016 at 7:33 PM, Gracjan Polak > wrote: >> >> Rustom Mody gmail.com> writes: >> >> > The old comint interface and new ? one -- when does which kick in >> >> There are quite some people out there using inf-haskell (comint) and >> larger >> number of interactive-haskell-mode users. > > > 1. Start in a foo.hs file > 2. Load file > 3. I get the lambda interface > > Instead > M-x run-haskell > I get old interface > > > How do I get one uniform interface? By not using run-haskell? I load up a file in Emacs. I use C-c C-l to load the file (which starts a new project if need be), and C-c C-r to reload it if I've changed it. I do have various customisations enabled (e.g. using structured-haskell-mode) but that's fundamentally how I interact with a ghci process (though ebal is definitely handing for setting up sandboxes and installing dependencies). -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From dominikbollmann at gmail.com Mon Apr 11 13:59:44 2016 From: dominikbollmann at gmail.com (Dominik Bollmann) Date: Mon, 11 Apr 2016 15:59:44 +0200 Subject: [Haskell-cafe] Differences between QuasiQuotes and TemplateHaskell Message-ID: <87wpo4mejz.fsf@t450s.i-did-not-set--mail-host-address--so-tickle-me> Hi, Originally, I thought that QuasiQuotes build on top of TemplateHaskell, since they just provide a way of parsing a string into a Template Haskell AST. That is, a quasi-quoter is defined by four parsers of types String -> Q Exp String -> Q Pat String -> Q Type String -> Q Dec that parse EDSLs into corresponding Haskell (abstract) syntax. However, while playing around with the Shakespeare package's quasiquoter hamlet, I noticed that (e.g.) a snippet html = [hamlet|

Hello World |] () has type Html and not (as I would expect) Q Exp. Hence, it seems as if quasiquotes are spliced in implicitly? This confuses me since in Template Haskell in general a quote (e.g.,) [e| \x -> x |] has type Q Exp, which then needs to be explicitly spliced in order to produce the id function \x -> x. So why do quasiquotes not have types Q Exp, but rather concrete types? If anyone could clarify my confusion, this would be great! Dominik. From eir at cis.upenn.edu Mon Apr 11 14:15:25 2016 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Mon, 11 Apr 2016 10:15:25 -0400 Subject: [Haskell-cafe] Differences between QuasiQuotes and TemplateHaskell In-Reply-To: <87wpo4mejz.fsf@t450s.i-did-not-set--mail-host-address--so-tickle-me> References: <87wpo4mejz.fsf@t450s.i-did-not-set--mail-host-address--so-tickle-me> Message-ID: <7A951722-164B-4272-9A0A-92D9B983A5E2@cis.upenn.edu> Counterintuitively, quasiquotes are like TH *splices* not TH *quotes*. This is true despite the fact that the quasiquote syntax looks just like a quote. And they're quasi*quotes*. But they really should be quasi*splices*. Specifically, > [blah|...|] is the same as > $(selector blah "...") where `selector` is the appropriate record selector based on the context where the quasiquote appears. You are not the first to fall into this trap! Though, I believe this is well documented in the manual. Richard On Apr 11, 2016, at 9:59 AM, Dominik Bollmann wrote: > > Hi, > > Originally, I thought that QuasiQuotes build on top of TemplateHaskell, > since they just provide a way of parsing a string into a Template > Haskell AST. That is, a quasi-quoter is defined by four parsers of types > > String -> Q Exp > String -> Q Pat > String -> Q Type > String -> Q Dec > > that parse EDSLs into corresponding Haskell (abstract) syntax. > > However, while playing around with the Shakespeare package's quasiquoter > hamlet, I noticed that (e.g.) a snippet > > html = [hamlet| > > >

Hello World > |] () > > has type Html and not (as I would expect) Q Exp. Hence, it seems as if > quasiquotes are spliced in implicitly? > > This confuses me since in Template Haskell in general a quote (e.g.,) > [e| \x -> x |] has type Q Exp, which then needs to be explicitly spliced > in order to produce the id function \x -> x. > > So why do quasiquotes not have types Q Exp, but rather concrete types? > > If anyone could clarify my confusion, this would be great! > > Dominik. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From david.feuer at gmail.com Mon Apr 11 20:07:42 2016 From: david.feuer at gmail.com (David Feuer) Date: Mon, 11 Apr 2016 16:07:42 -0400 Subject: [Haskell-cafe] Is it safe to postulate () has one inhabitant? In-Reply-To: References: Message-ID: The () kind has infinitely many inhabitants: the type '() and any stuck or looping types with appropriate kinds. However, I've not been able to find a way to break type safety with the postulate unitsEqual :: (a :: ()) :~: (b :: ()) in GHC 7.10.3 (it was possible using a now-rejected data family in 7.8.3). Is there some way I haven't found yet, or is this safe? If it's *not* safe, is the equivalent postulate using Void instead of () safe? For my purposes, () would be nicer, but it feels riskier. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexey.raga at gmail.com Mon Apr 11 22:36:09 2016 From: alexey.raga at gmail.com (Alexey Raga) Date: Mon, 11 Apr 2016 22:36:09 +0000 Subject: [Haskell-cafe] Haskell, stack and the Atom editor In-Reply-To: References: <570952BF.6070304@posteo.de> Message-ID: Another thing you can try is Visual Studio Code. It is an electron-based ide (just as atom) and after installing haskell plugins it just works. On Sun, 10 Apr 2016 12:47 Thomas Koster wrote: > On 9 April 2016 at 17:03, Thomas Koster wrote: > > I want to switch to the Atom editor for my Haskell development. I have > tried > > several times over the last few years and given up each time because > hardly > > anything works. > > > > At this point I am ready to give up yet again. Does anybody have any > > last-minute advice on using Atom to develop with Haskell and Stack? > > On 9 April 2016 at 21:42, Raphael Gaschignard wrote: > > ide-haskell has recently gotten a slack backend > > (https://atom.io/packages/ide-haskell-stack). Could be worth your time. > > According to the ide-haskell github issue, the support is pretty "bare > > bones"(https://github.com/atom-haskell/ide-haskell/issues/108) but > likely > > better than a language-agnostic linter tool > > On 10 April 2016 at 01:56, Wojciech Danilo > wrote: > > I'm using Atom for a week for a big commercial Haskell project. It has > some > > minuses and the ide-haskell is not the best it could be, but it works > better > > than any editor I've been using so far for Haskell development (mainly > > sublime). The type-checking, linting and error displaying inside > text-editor > > is almost real-time on modern hardware. I've been not using emacs mostly > > because I prefer the sublime-like style of work. The guys behind > ide-haskell > > seem to be pretty active and helpful and they develop it pretty fast. > After > > installing everything ide-haskell worked out-of the box for me. > > On 10 April 2016 at 05:06, Anton Felix Lorenzen wrote: > > I am using atom with ide-haskell and stack. > > Basically all you need is to load ghc-mod in stack: > >> stack install ghc-mod > >> stack exec atom > > > > It needs some time to build, but then it works really well. > > It has minor issues though: > > - It doesn't lookup, whether an import is legal > > (e.g. if the matching package is installed) > > - You can't trigger a build process inside atom > > > > But aside from that it is fine. > > I can only recommend it. > > Thanks Raphael, Wojciech and Anton. I tried out ide-haskell with the > ide-haskell-stack backend. Everything seems to be working well enough > to give it a go for my next project. > > However, type-checking, linting and error display inside the editor is > far from real-time for me (never < 1s), but they never were for me, so > I don't think that has anything to do with Atom. > > -- > Thomas Koster > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexey.raga at gmail.com Mon Apr 11 22:42:26 2016 From: alexey.raga at gmail.com (Alexey Raga) Date: Mon, 11 Apr 2016 22:42:26 +0000 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: For easy, quick and working configuration one can use Spacemacs project. All that is needed is to switch on what they call required 'layers' and off we go. The Haskell layer is quite good, it will automatically install haskell-mode and other goodness. On Mon, 11 Apr 2016 21:50 Ivan Lazar Miljenovic wrote: > On 11 April 2016 at 15:03, Rustom Mody wrote: > > > > > > On Sun, Apr 10, 2016 at 7:33 PM, Gracjan Polak > > wrote: > >> > >> Rustom Mody gmail.com> writes: > >> > >> > The old comint interface and new ? one -- when does which kick in > >> > >> There are quite some people out there using inf-haskell (comint) and > >> larger > >> number of interactive-haskell-mode users. > > > > > > 1. Start in a foo.hs file > > 2. Load file > > 3. I get the lambda interface > > > > Instead > > M-x run-haskell > > I get old interface > > > > > > How do I get one uniform interface? > > By not using run-haskell? > > I load up a file in Emacs. I use C-c C-l to load the file (which > starts a new project if need be), and C-c C-r to reload it if I've > changed it. > > I do have various customisations enabled (e.g. using > structured-haskell-mode) but that's fundamentally how I interact with > a ghci process (though ebal is definitely handing for setting up > sandboxes and installing dependencies). > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Tue Apr 12 00:49:45 2016 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Mon, 11 Apr 2016 20:49:45 -0400 Subject: [Haskell-cafe] Is it safe to postulate () has one inhabitant? In-Reply-To: References: Message-ID: <5F74A96C-6F4F-4E90-8B8E-668D0AA4A307@cis.upenn.edu> I believe this is safe, yes. Saying the kind () has infinitely many types in it is somewhat like saying the type () has infinitely many terms in it, like (), undefined, undefined 1, undefined False, ... With the change to type families in the past few years, it should be impossible to match on any inhabitant of the kind () except the type '(). That makes the postulate you postulate quite sensible. Richard On Apr 11, 2016, at 4:07 PM, David Feuer wrote: > The () kind has infinitely many inhabitants: the type '() and any stuck or looping types with appropriate kinds. However, I've not been able to find a way to break type safety with the postulate > > unitsEqual :: (a :: ()) :~: (b :: ()) > > in GHC 7.10.3 (it was possible using a now-rejected data family in 7.8.3). Is there some way I haven't found yet, or is this safe? If it's *not* safe, is the equivalent postulate using Void instead of () safe? For my purposes, () would be nicer, but it feels riskier. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Tue Apr 12 02:31:22 2016 From: david.feuer at gmail.com (David Feuer) Date: Mon, 11 Apr 2016 22:31:22 -0400 Subject: [Haskell-cafe] Is it safe to postulate () has one inhabitant? In-Reply-To: References: <5F74A96C-6F4F-4E90-8B8E-668D0AA4A307@cis.upenn.edu> Message-ID: Great. My aim is to convert a poly-kinded implementation, s, of type-aligned sequences into an implementation of regular sequences by using newtype AsUnitLoop a (x :: ()) (y :: ()) = UL a newtype Lower s a = Lower' (s (AsUnitLoop a) '() '()) Using the postulate, I can "prove" that s (AsUnitLoop a) x y ~ s (AsUnitLoop a) '() '() So when I take the tail/init of a sequence I will again get a sequence, and two sequences holding values of the same type can be concatenated. The original reflection-without-remorse code uses data AsUnitLoop a (x :: *) (y :: *) where UL : a -> AsUnitLoop a () () which adds an extra constructor to each cell. With the postulate, I get what I want for free. I'm *hoping* it's possible to use a pattern synonym, Lower, that converts s (AsUnitLoop a) '() '() (requiring '()) to Lower s a but that provides only exists x y . s (AsUnitLoop a) x y when matching. This way, the postulate won't "leak" to other code unless it imports a Postulate module. Unfortunately, the pattern synonym documentation is a bit vague on types. On Apr 11, 2016 8:49 PM, "Richard Eisenberg" wrote: I believe this is safe, yes. Saying the kind () has infinitely many types in it is somewhat like saying the type () has infinitely many terms in it, like (), undefined, undefined 1, undefined False, ... With the change to type families in the past few years, it should be impossible to match on any inhabitant of the kind () except the type '(). That makes the postulate you postulate quite sensible. Richard On Apr 11, 2016, at 4:07 PM, David Feuer wrote: The () kind has infinitely many inhabitants: the type '() and any stuck or looping types with appropriate kinds. However, I've not been able to find a way to break type safety with the postulate unitsEqual :: (a :: ()) :~: (b :: ()) in GHC 7.10.3 (it was possible using a now-rejected data family in 7.8.3). Is there some way I haven't found yet, or is this safe? If it's *not* safe, is the equivalent postulate using Void instead of () safe? For my purposes, () would be nicer, but it feels riskier. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter at psftw.com Tue Apr 12 02:53:13 2016 From: peter at psftw.com (Peter Salvatore) Date: Mon, 11 Apr 2016 22:53:13 -0400 Subject: [Haskell-cafe] Haskell DockerHub Official Repository: Needs Maintainer TLC Message-ID: Greetings, I have a confession to make: I've been a neglectful maintainer of the "haskell" Official Repository on DockerHub. I'm hoping to find a proper maintainer who is both a Docker nerd and a Haskell enthusiast to ensure that it is kept up to date and improved over time. Bonus points for someone involved in GHC development, or at an organization that is heavily involved in the Haskell community. I'm happy to help you get up to speed with where the image is at today and how to effectively submit future iterations after you've had a chance to review the DockerHub Official Repositories documentation at https://docs.docker.com/docker-hub/official_repos/. The current Dockerfiles are located at https://github.com/freebroccolo/docker-haskell and there are two other maintainers who also contribute occasionally. Thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Tue Apr 12 06:03:37 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Tue, 12 Apr 2016 09:03:37 +0300 Subject: [Haskell-cafe] Haskell DockerHub Official Repository: Needs Maintainer TLC In-Reply-To: References: Message-ID: <7802B211-A45F-4CC7-8F4E-F297661D3037@iki.fi> Hello, I?m interested in this duty. I think I?ll be a good fit for this job. I?m obviously Haskell enthusiast, maintain unofficial gcc-docker-image [1] (which ubuntu images look quite similar to official ones atm). I?m very little involved in GHC development, yet follow it tightly. At my day job I write Haskell full-time, and our deployment is docker based, and I have opportunity to do open-source contributions as part of the work time. [1]: https://hub.docker.com/r/phadej/ghc/ Cheers, Oleg Grenrus > On 12 Apr 2016, at 05:53, Peter Salvatore wrote: > > Greetings, > > I have a confession to make: I've been a neglectful maintainer of the "haskell" Official Repository on DockerHub. I'm hoping to find a proper maintainer who is both a Docker nerd and a Haskell enthusiast to ensure that it is kept up to date and improved over time. Bonus points for someone involved in GHC development, or at an organization that is heavily involved in the Haskell community. I'm happy to help you get up to speed with where the image is at today and how to effectively submit future iterations after you've had a chance to review the DockerHub Official Repositories documentation at https://docs.docker.com/docker-hub/official_repos/ . The current Dockerfiles are located at https://github.com/freebroccolo/docker-haskell and there are two other maintainers who also contribute occasionally. > > Thanks, > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From P.Achten at cs.ru.nl Tue Apr 12 07:35:47 2016 From: P.Achten at cs.ru.nl (Peter Achten) Date: Tue, 12 Apr 2016 09:35:47 +0200 Subject: [Haskell-cafe] [TFP 2016] extended deadline, april 25 2016, final call for papers Message-ID: <570CA553.3010502@cs.ru.nl> TFP 2016 has extended its deadline for draft papers by two weeks (now April 25). Although all draft papers accepted to TFP 2016 will be invited to submit to the post-symposium formal proceedings, authors are reminded that they are not obligated to do so; we welcome works in progress that may not be destined for the TFP proceedings. Thanks, David Van Horn ----------------------------- C A L L F O R P A P E R S ----------------------------- ======== TFP 2016 =========== 17th Symposium on Trends in Functional Programming June 8-10, 2016 University of Maryland, College Park Near Washington, DC http://tfp2016.org/ The symposium on Trends in Functional Programming (TFP) is an international forum for researchers with interests in all aspects of functional programming, taking a broad view of current and future trends in the area. It aspires to be a lively environment for presenting the latest research results, and other contributions (see below). Authors of draft papers will be invited to submit revised papers based on the feedback receive at the symposium. A post-symposium refereeing process will then select a subset of these articles for formal publication. TFP 2016 will be the main event of a pair of functional programming events. TFP 2016 will be accompanied by the International Workshop on Trends in Functional Programming in Education (TFPIE), which will take place on June 7nd. == INVITED SPEAKERS == TFP 2016 is pleased to announce keynote talks by the following two invited speakers: * Ronald Garcia, University of British Columbia: "Static and Dynamic Type Checking: A Synopsis" * Steve Zdancewic, University of Pennsylvania: "Type- and Example-Driven Program Synthesis" == HISTORY == The TFP symposium is the heir of the successful series of Scottish Functional Programming Workshops. Previous TFP symposia were held in * Edinburgh (Scotland) in 2003; * Munich (Germany) in 2004; * Tallinn (Estonia) in 2005; * Nottingham (UK) in 2006; * New York (USA) in 2007; * Nijmegen (The Netherlands) in 2008; * Komarno (Slovakia) in 2009; * Oklahoma (USA) in 2010; * Madrid (Spain) in 2011; * St. Andrews (UK) in 2012; * Provo (Utah, USA) in 2013; * Soesterberg (The Netherlands) in 2014; * and Inria Sophia-Antipolis (France) in 2015. For further general information about TFP please see the TFP homepage. (http://www.tifp.org/). == SCOPE == The symposium recognizes that new trends may arise through various routes. As part of the Symposium's focus on trends we therefore identify the following five article categories. High-quality articles are solicited in any of these categories: Research Articles: leading-edge, previously unpublished research work Position Articles: on what new trends should or should not be Project Articles: descriptions of recently started new projects Evaluation Articles: what lessons can be drawn from a finished project Overview Articles: summarizing work with respect to a trendy subject Articles must be original and not simultaneously submitted for publication to any other forum. They may consider any aspect of functional programming: theoretical, implementation-oriented, or experience-oriented. Applications of functional programming techniques to other languages are also within the scope of the symposium. Topics suitable for the symposium include, but are not limited to: Functional programming and multicore/manycore computing Functional programming in the cloud High performance functional computing Extra-functional (behavioural) properties of functional programs Dependently typed functional programming Validation and verification of functional programs Debugging and profiling for functional languages Functional programming in different application areas: security, mobility, telecommunications applications, embedded systems, global computing, grids, etc. Interoperability with imperative programming languages Novel memory management techniques Program analysis and transformation techniques Empirical performance studies Abstract/virtual machines and compilers for functional languages (Embedded) domain specific languages New implementation strategies Any new emerging trend in the functional programming area If you are in doubt on whether your article is within the scope of TFP, please contact the TFP 2016 program chair, David Van Horn. == BEST PAPER AWARDS == To reward excellent contributions, TFP awards a prize for the best paper accepted for the formal proceedings. TFP traditionally pays special attention to research students, acknowledging that students are almost by definition part of new subject trends. A student paper is one for which the authors state that the paper is mainly the work of students, the students are listed as first authors, and a student would present the paper. A prize for the best student paper is awarded each year. In both cases, it is the PC of TFP that awards the prize. In case the best paper happens to be a student paper, that paper will then receive both prizes. == SPONSORS == TFP is financially supported by CyberPoint, Galois, Trail of Bits, and the University of Maryland Computer Science Department. == PAPER SUBMISSIONS == Acceptance of articles for presentation at the symposium is based on a lightweight peer review process of extended abstracts (4 to 10 pages in length) or full papers (20 pages). The submission must clearly indicate which category it belongs to: research, position, project, evaluation, or overview paper. It should also indicate which authors are research students, and whether the main author(s) are students. A draft paper for which ALL authors are students will receive additional feedback by one of the PC members shortly after the symposium has taken place. We use EasyChair for the refereeing process. Papers must be submitted at: https://easychair.org/conferences/?conf=tfp2016 Papers must be written in English, and written using the LNCS style. For more information about formatting please consult the Springer LNCS web site: http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0 == IMPORTANT DATES == Submission of draft papers: April 25, 2016 Notification: May 2, 2016 Registration: May 13, 2016 TFP Symposium: June 8-10, 2016 Student papers feedback: June 14, 2016 Submission for formal review: July 14, 2016 Notification of acceptance: September 14, 2016 Camera ready paper: October 14, 2016 == PROGRAM COMMITTEE == Amal Ahmed Northeastern University (US) Nada Amin ?cole Polytechnique F?d?rale de Lausanne (CH) Kenichi Asai Ochanomizu University (JP) Ma?gorzata Biernacka University of Wroclaw (PL) Laura Castro University of A Coru?a (ES) Ravi Chugh University of Chicago (US) Silvia Ghilezan University of Novi Sad (SR) Clemens Grelck University of Amsterdam (NL) John Hughes Chalmers University of Technology (SE) Suresh Jagannathan Purdue University (US) Pieter Koopman Radboud University Nijmegen (NL) Geoffrey Mainland Drexel University (US) Chris Martens University of California, Santa Cruz (US) Jay McCarthy University of Massachusetts, Lowell (US) Heather Miller ?cole Polytechnique F?d?rale de Lausanne (CH) Manuel Serrano INRIA, Sophia-Antipolis (FR) Scott Smith Johns Hopkins University (US) ?ric Tanter University of Chile (CL) David Van Horn (Chair) University of Maryland (US) Niki Vazou University of California, San Diego (US) Stephanie Weirich University of Pennsylvania (US) From adam at well-typed.com Tue Apr 12 07:41:32 2016 From: adam at well-typed.com (Adam Gundry) Date: Tue, 12 Apr 2016 08:41:32 +0100 Subject: [Haskell-cafe] Is it safe to postulate () has one inhabitant? In-Reply-To: <5F74A96C-6F4F-4E90-8B8E-668D0AA4A307@cis.upenn.edu> References: <5F74A96C-6F4F-4E90-8B8E-668D0AA4A307@cis.upenn.edu> Message-ID: <570CA6AC.8060009@well-typed.com> I agree that this should be safe, although it would be nice if someone proved it! Another way to think of it is as a consequence of the eta rule: forall (a :: ()) . a ~ '() There is an existing feature request [1] to add eta conversion to GHC, which should include this. All the best, Adam [1] https://ghc.haskell.org/trac/ghc/ticket/7259 On 12/04/16 01:49, Richard Eisenberg wrote: > I believe this is safe, yes. > > Saying the kind () has infinitely many types in it is somewhat like > saying the type () has infinitely many terms in it, like (), undefined, > undefined 1, undefined False, ... With the change to type families in > the past few years, it should be impossible to match on any inhabitant > of the kind () except the type '(). That makes the postulate you > postulate quite sensible. > > Richard > > On Apr 11, 2016, at 4:07 PM, David Feuer > wrote: > >> The () kind has infinitely many inhabitants: the type '() and any >> stuck or looping types with appropriate kinds. However, I've not been >> able to find a way to break type safety with the postulate >> >> unitsEqual :: (a :: ()) :~: (b :: ()) >> >> in GHC 7.10.3 (it was possible using a now-rejected data family in >> 7.8.3). Is there some way I haven't found yet, or is this safe? If >> it's *not* safe, is the equivalent postulate using Void instead of () >> safe? For my purposes, () would be nicer, but it feels riskier. -- Adam Gundry, Haskell Consultant Well-Typed LLP, http://www.well-typed.com/ From tkoster at gmail.com Tue Apr 12 07:57:38 2016 From: tkoster at gmail.com (Thomas Koster) Date: Tue, 12 Apr 2016 17:57:38 +1000 Subject: [Haskell-cafe] Are libraries expected to enforce safe usage of thread-unsafe functions? Message-ID: Hi friends, I am writing a library that has Handle-like values for resources that are not thread-safe (foreign state from a non-thread-safe C library). In other words, a resource can only be "used" by one Haskell thread at a time. Unless I take steps, if one shares the resource between concurrent Haskell threads, bad things will happen at runtime (even with a single-threaded runtime). Naturally, I want consumers to use my library safely, so I am considering making it safe for all by pessimistically enforcing safe usage with MVars. Is it common/expected that Haskell libraries enforce safe access like this? MVars are not free from cost, but are they cheap (i.e. almost as fast as no forced synchronization) as long as no blocking/rescheduling occurs? Thanks, -- Thomas Koster -------------- next part -------------- An HTML attachment was scrubbed... URL: From edwards.benj at gmail.com Tue Apr 12 08:48:39 2016 From: edwards.benj at gmail.com (Benjamin Edwards) Date: Tue, 12 Apr 2016 08:48:39 +0000 Subject: [Haskell-cafe] Are libraries expected to enforce safe usage of thread-unsafe functions? In-Reply-To: References: Message-ID: Presumably you will have a safe and an unsafe variant of each function, the safe one calling its corresponding unsafe variant guarded by an appropriate locking mechanism. Just export both and note why the unsafe variants are marked "unsafe". Separating policy from implementation is always nice for callers. Presumably they know their application and what they are willing to pay for each call. Best, Ben On Tue, 12 Apr 2016 at 08:57 Thomas Koster wrote: > Hi friends, > > I am writing a library that has Handle-like values for resources that are > not thread-safe (foreign state from a non-thread-safe C library). In other > words, a resource can only be "used" by one Haskell thread at a time. > Unless I take steps, if one shares the resource between concurrent Haskell > threads, bad things will happen at runtime (even with a single-threaded > runtime). > > Naturally, I want consumers to use my library safely, so I am considering > making it safe for all by pessimistically enforcing safe usage with MVars. > > Is it common/expected that Haskell libraries enforce safe access like this? > > MVars are not free from cost, but are they cheap (i.e. almost as fast as > no forced synchronization) as long as no blocking/rescheduling occurs? > > Thanks, > -- > Thomas Koster > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Tue Apr 12 11:41:15 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Tue, 12 Apr 2016 17:11:15 +0530 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: On Mon, Apr 11, 2016 at 5:19 PM, Ivan Lazar Miljenovic < ivan.miljenovic at gmail.com> wrote: > On 11 April 2016 at 15:03, Rustom Mody wrote: > > > > > > On Sun, Apr 10, 2016 at 7:33 PM, Gracjan Polak > > wrote: > >> > >> Rustom Mody gmail.com> writes: > >> > >> > The old comint interface and new ? one -- when does which kick in > >> > >> There are quite some people out there using inf-haskell (comint) and > >> larger > >> number of interactive-haskell-mode users. > > > > > > 1. Start in a foo.hs file > > 2. Load file > > 3. I get the lambda interface > > > > Instead > > M-x run-haskell > > I get old interface > > > > > > How do I get one uniform interface? > > By not using run-haskell? > :-) I figured that much out; viz that even if I dont need a file immediately I need to create a dummy hs file and load it. > I load up a file in Emacs. I use C-c C-l to load the file (which > starts a new project if need be), and C-c C-r to reload it if I've > changed it. > > I do have various customisations enabled (e.g. using > structured-haskell-mode) but that's fundamentally how I interact with > a ghci process (though ebal is definitely handing for setting up > sandboxes and installing dependencies). > Sorry couldn't quite parse last sentence -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Tue Apr 12 12:04:02 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Tue, 12 Apr 2016 22:04:02 +1000 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: On 12 April 2016 at 21:41, Rustom Mody wrote: > > > On Mon, Apr 11, 2016 at 5:19 PM, Ivan Lazar Miljenovic > wrote: >> >> On 11 April 2016 at 15:03, Rustom Mody wrote: >> > >> > >> > On Sun, Apr 10, 2016 at 7:33 PM, Gracjan Polak >> > wrote: >> >> >> >> Rustom Mody gmail.com> writes: >> >> >> >> > The old comint interface and new ? one -- when does which kick in >> >> >> >> There are quite some people out there using inf-haskell (comint) and >> >> larger >> >> number of interactive-haskell-mode users. >> > >> > >> > 1. Start in a foo.hs file >> > 2. Load file >> > 3. I get the lambda interface >> > >> > Instead >> > M-x run-haskell >> > I get old interface >> > >> > >> > How do I get one uniform interface? >> >> By not using run-haskell? > > > :-) > > I figured that much out; viz that even if I dont need a file immediately I > need to create a dummy hs file and load it. > > >> >> I load up a file in Emacs. I use C-c C-l to load the file (which >> starts a new project if need be), and C-c C-r to reload it if I've >> changed it. >> >> I do have various customisations enabled (e.g. using >> structured-haskell-mode) but that's fundamentally how I interact with >> a ghci process (though ebal is definitely handing for setting up >> sandboxes and installing dependencies). > > > Sorry couldn't quite parse last sentence structured-haskell-mode aims to provide node-based editing support for Haskell code (ala paredit for Lisps); ebal is another mode that helps running cabal-install or stack. Most of the rest of my customisations is more about keybindings (and various failed experiments like code folding that I tried but no longer use); haskell-mode is fairly usable out-of-the-box. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From johannes.waldmann at htwk-leipzig.de Tue Apr 12 16:43:01 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Tue, 12 Apr 2016 18:43:01 +0200 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) Message-ID: <570D2595.3060401@htwk-leipzig.de> > ... failed experiments like code folding So, what *is* the recommended method for folding (in emacs)? Yes, ideally we don't need this, because we do not write deeply nested code. But then we have a lot of top-level declarations, which I still want to fold. Yes, if there are too many declarations in one module, then this should be split. But still, that whole mess of declarations needs to be navigated, no matter how it's mapped to files (modules). The question is how it's mapped to the screen real estate. - J.W. From rustompmody at gmail.com Tue Apr 12 16:58:25 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Tue, 12 Apr 2016 22:28:25 +0530 Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) In-Reply-To: References: Message-ID: Replying to myself for anyone else who finds this On Tue, Apr 12, 2016 at 5:11 PM, Rustom Mody wrote: > > > On Mon, Apr 11, 2016 at 5:19 PM, Ivan Lazar Miljenovic < > ivan.miljenovic at gmail.com> wrote: > >> On 11 April 2016 at 15:03, Rustom Mody wrote: >> > >> > >> > On Sun, Apr 10, 2016 at 7:33 PM, Gracjan Polak >> > wrote: >> >> >> >> Rustom Mody gmail.com> writes: >> >> >> >> > The old comint interface and new ? one -- when does which kick in >> >> >> >> There are quite some people out there using inf-haskell (comint) and >> >> larger >> >> number of interactive-haskell-mode users. >> > >> > >> > 1. Start in a foo.hs file >> > 2. Load file >> > 3. I get the lambda interface >> > >> > Instead >> > M-x run-haskell >> > I get old interface >> > >> > >> > How do I get one uniform interface? >> >> By not using run-haskell? >> > > :-) > > I figured that much out; viz that even if I dont need a file immediately I > need to create a dummy hs file and load it. > Started with the minimum setup recommended in the Readme: (add-to-list 'load-path "~/lib/emacs/haskell-mode/") (require 'haskell-mode-autoloads) (add-to-list 'Info-default-directory-list "~/lib/emacs/haskell-mode/") Now from a haskell file doing C-c C-l does nothing but tell me to study haskell-mode for more instructions -- O well So look up haskell mode that has: For more information see also Info node `(haskell-mode)Getting Started'. However the Getting started is a broken link -- "No such node or anchor" It is (info "(haskell-mode)Interactive Haskell") which has the key bindings needed to get it working -------------- next part -------------- An HTML attachment was scrubbed... URL: From gracjanpolak at gmail.com Tue Apr 12 17:16:23 2016 From: gracjanpolak at gmail.com (Gracjan Polak) Date: Tue, 12 Apr 2016 17:16:23 +0000 (UTC) Subject: [Haskell-cafe] Emacs (was stack and the Atom editor) References: Message-ID: Rustom Mody gmail.com> writes: > Now from a haskell file doing C-c C-l > > does nothing but tell me to study haskell-mode for more instructions? -- O well > > So look up haskell mode that has:??? For more information see also Info node `(haskell-mode)Getting Started'. > > However the Getting started is a broken link -- "No such node or anchor" > > It is (info "(haskell-mode)Interactive Haskell") > > which has the key bindings needed to get it working We accept patches for documentation, if you can help it would be appreciated. Note also our ticket: https://github.com/haskell/haskell-mode/issues/706 -- Gracjan From code at funwithsoftware.org Tue Apr 12 18:35:03 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Tue, 12 Apr 2016 11:35:03 -0700 Subject: [Haskell-cafe] Haskell on OpenWRT In-Reply-To: References: <5708B534.9010109@funwithsoftware.org> <20160409084618.4378706.35395.3068@amok.cc> <570AB023.1010900@funwithsoftware.org> Message-ID: <570D3FD7.8080701@funwithsoftware.org> On 4/10/16 1:03 PM, Tomas Carnecky wrote: > crosstools-ng can be configured so that the compiler always produces a > static build (run ct-ng menuconfig, and look through the options. The > UI should be familiar if you've ever used the Linux kernel menuconfig > facility). I decided to try your approach, but I'm running into a few problems. First, where in the UI is the option to make the compiler produce a static build? Under "Toolchain Options", there is an option to link the toolchain itself statically, but that's not the same thing. I've gone through all the menus, and can't find anything else about static linking. Second, what libraries did you have to build for the target before you could get ghc to compile? I've been trying to build the ghc cross-compiler, but ghc seems to insist on having ncurses on the target. So now I've gone down the rabbit hole of building ncurses for the target. Currently the build of ncurses is failing with: x86_64-unknown-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include -DNDEBUG -O2 --param max-inline-insns-single=1200 -c ../ncurses/lib_gen.c -o ../objects/lib_gen.o In file included from ./curses.priv.h:325:0, from ../ncurses/lib_gen.c:19: _20591.c:843:15: error: expected ')' before 'int' ../include/curses.h:1631:56: note: in definition of macro 'mouse_trafo' #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) ^ make[1]: *** [../objects/lib_gen.o] Error 1 make[1]: Leaving directory `/home/ppelletier/src/ncurses-6.0/ncurses' make: *** [all] Error 2 I'm sure I can figure it out, but I'm worried about how many more libraries might be needed in addition to ncurses. Did you just have to slog through all of this, or am I doing something wrong? Thanks, --Patrick From tomas.carnecky at gmail.com Tue Apr 12 18:54:45 2016 From: tomas.carnecky at gmail.com (Tomas Carnecky) Date: Tue, 12 Apr 2016 18:54:45 +0000 Subject: [Haskell-cafe] Haskell on OpenWRT In-Reply-To: <570D3FD7.8080701@funwithsoftware.org> References: <5708B534.9010109@funwithsoftware.org> <20160409084618.4378706.35395.3068@amok.cc> <570AB023.1010900@funwithsoftware.org> <570D3FD7.8080701@funwithsoftware.org> Message-ID: ncurses is the only library. Not sure how I managed to configure the crosscompiler to produce static binaries, maybe it was an option which I had to pass to GHC. In any case, here's a docker image which includes instructions how I build the cross compiler: https://github.com/wereHamster/onion-omega/tree/master/xt, and here's a docker image which builds on top of that to compile a cross-compiling GHC: https://github.com/wereHamster/onion-omega/tree/master/ghc. On Tue, Apr 12, 2016 at 8:35 PM Patrick Pelletier wrote: > On 4/10/16 1:03 PM, Tomas Carnecky wrote: > > crosstools-ng can be configured so that the compiler always produces a > > static build (run ct-ng menuconfig, and look through the options. The > > UI should be familiar if you've ever used the Linux kernel menuconfig > > facility). > > I decided to try your approach, but I'm running into a few problems. > > First, where in the UI is the option to make the compiler produce a > static build? Under "Toolchain Options", there is an option to link the > toolchain itself statically, but that's not the same thing. I've gone > through all the menus, and can't find anything else about static linking. > > Second, what libraries did you have to build for the target before you > could get ghc to compile? I've been trying to build the ghc > cross-compiler, but ghc seems to insist on having ncurses on the > target. So now I've gone down the rabbit hole of building ncurses for > the target. Currently the build of ncurses is failing with: > > x86_64-unknown-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include -DNDEBUG > -O2 --param max-inline-insns-single=1200 -c ../ncurses/lib_gen.c -o > ../objects/lib_gen.o > In file included from ./curses.priv.h:325:0, > from ../ncurses/lib_gen.c:19: > _20591.c:843:15: error: expected ')' before 'int' > ../include/curses.h:1631:56: note: in definition of macro 'mouse_trafo' > #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) > ^ > make[1]: *** [../objects/lib_gen.o] Error 1 > make[1]: Leaving directory `/home/ppelletier/src/ncurses-6.0/ncurses' > make: *** [all] Error 2 > > I'm sure I can figure it out, but I'm worried about how many more > libraries might be needed in addition to ncurses. Did you just have to > slog through all of this, or am I doing something wrong? > > Thanks, > > --Patrick > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Tue Apr 12 20:01:37 2016 From: david.feuer at gmail.com (David Feuer) Date: Tue, 12 Apr 2016 16:01:37 -0400 Subject: [Haskell-cafe] Is it safe to postulate () has one inhabitant? In-Reply-To: <570CA6AC.8060009@well-typed.com> References: <5F74A96C-6F4F-4E90-8B8E-668D0AA4A307@cis.upenn.edu> <570CA6AC.8060009@well-typed.com> Message-ID: I have heard of this "eta rule" before, but I know nothing about type theory. What does the rule say? On Tue, Apr 12, 2016 at 3:41 AM, Adam Gundry wrote: > I agree that this should be safe, although it would be nice if someone > proved it! Another way to think of it is as a consequence of the eta rule: > > forall (a :: ()) . a ~ '() > > There is an existing feature request [1] to add eta conversion to GHC, > which should include this. > > All the best, > > Adam > > [1] https://ghc.haskell.org/trac/ghc/ticket/7259 > > > On 12/04/16 01:49, Richard Eisenberg wrote: >> I believe this is safe, yes. >> >> Saying the kind () has infinitely many types in it is somewhat like >> saying the type () has infinitely many terms in it, like (), undefined, >> undefined 1, undefined False, ... With the change to type families in >> the past few years, it should be impossible to match on any inhabitant >> of the kind () except the type '(). That makes the postulate you >> postulate quite sensible. >> >> Richard >> >> On Apr 11, 2016, at 4:07 PM, David Feuer > > wrote: >> >>> The () kind has infinitely many inhabitants: the type '() and any >>> stuck or looping types with appropriate kinds. However, I've not been >>> able to find a way to break type safety with the postulate >>> >>> unitsEqual :: (a :: ()) :~: (b :: ()) >>> >>> in GHC 7.10.3 (it was possible using a now-rejected data family in >>> 7.8.3). Is there some way I haven't found yet, or is this safe? If >>> it's *not* safe, is the equivalent postulate using Void instead of () >>> safe? For my purposes, () would be nicer, but it feels riskier. > > > -- > Adam Gundry, Haskell Consultant > Well-Typed LLP, http://www.well-typed.com/ > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From winterkoninkje at gmail.com Wed Apr 13 00:43:39 2016 From: winterkoninkje at gmail.com (wren romano) Date: Tue, 12 Apr 2016 20:43:39 -0400 Subject: [Haskell-cafe] Is it safe to postulate () has one inhabitant? In-Reply-To: References: <5F74A96C-6F4F-4E90-8B8E-668D0AA4A307@cis.upenn.edu> <570CA6AC.8060009@well-typed.com> Message-ID: On Tue, Apr 12, 2016 at 4:01 PM, David Feuer wrote: > I have heard of this "eta rule" before, but I know nothing about type > theory. What does the rule say? In the general use case, "eta rules" are rules that state that any term of a given type must have a specific form defined by the introduction and elimination rules for the type. The standard/original version of eta is for function types: forall (e :: a -> b). e = (\x -> e x) But we can generalize this to other types with a single constructor. For example: forall (e :: ()). e = () forall (e :: (a,b)). e = (fst e, snd e) For any given language/theory, these various eta rules may or may not be true. In Haskell because of decisions about un/liftedness, they prettymuch never hold at the term level. The major counterexamples being _|_ /= (\x -> _|_ x) and _|_ /= (fst _|_, snd _|_). Of course, one could have eta for functions without having it for tuples, and vice versa; there's nothing tying them together. Getting back to the original query, the question is whether these eta rules hold "one level up" where types must be expandable/contractible in particular ways based on the intro/elim rules for their kind. Since we don't have any notion of undefined at the type level, the obvious counterexamples go away; but that still doesn't guarantee they hold. (For example, if we do not allow reduction under binders, then the eta rule for functions won't hold (except perhaps in an up-to-observability sort of way)). -- Live well, ~wren From tkoster at gmail.com Wed Apr 13 01:12:20 2016 From: tkoster at gmail.com (Thomas Koster) Date: Wed, 13 Apr 2016 11:12:20 +1000 Subject: [Haskell-cafe] Are libraries expected to enforce safe usage of thread-unsafe functions? In-Reply-To: References: Message-ID: Ben, On 12 April 2016 at 17:57, Thomas Koster wrote: > I am writing a library that has Handle-like values for resources that are > not thread-safe (foreign state from a non-thread-safe C library). > > Naturally, I want consumers to use my library safely, so I am considering > making it safe for all by pessimistically enforcing safe usage with MVars. > > Is it common/expected that Haskell libraries enforce safe access like this? On 12 April 2016 at 18:48, Benjamin Edwards wrote: > Presumably you will have a safe and an unsafe variant of each function, the > safe one calling its corresponding unsafe variant guarded by an appropriate > locking mechanism. Just export both and note why the unsafe variants are > marked "unsafe". Separating policy from implementation is always nice for > callers. Presumably they know their application and what they are willing to > pay for each call. Good idea. At this time I think I will do just that. Easy to benchmark to measure the cost difference too. Thanks, Thomas Koster From dct25-561bs at mythic-beasts.com Wed Apr 13 06:47:42 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Wed, 13 Apr 2016 07:47:42 +0100 Subject: [Haskell-cafe] Proposal: Add functions to get consecutive elements to Data.List In-Reply-To: References: Message-ID: Hi there, The idiom I normally use for this is 'zip xs (drop 1 xs)'. By using 'drop 1' instead of 'tail' it handles the empty case without partiality or needing an extra equation. Does that work for you? Cheers, David On 12 Apr 2016 21:55, "Johan Holmquist" wrote: I propose adding two new functions to Data.List: zipConsecutives :: [a] -> [(a,a)] zipConsecutives xs = zip xs (tail xs) zipConsecutivesWith :: (a -> a -> b) -> [a] -> [b] zipConsecutivesWith f xs = zipWith f xs (tail xs) (with possibly more efficient implementations) The Trac feature request is at https://ghc.haskell.org/trac/ghc/ticket/11815 . Why These functions are useful when one wants to process consecutive pairs of elements in a sequence, which is not uncommon. The ticket lists some examples, reiterated here: -- diff consecutive elements: diffs = zipConsecutivesWith (flip (-)) -- determine if list is ascending (similar for descending and strict): isAscending = and . zipConsecutivesWith (<=) -- an old friend of ours: fibs = 1 : 1 : zipConsecutivesWith (+) fibs -- get the edges of a closed path defined by points (ps): edges ps = zipConsecutivesWith makeEdge (ps ++ take 1 ps) Why add to Data.List (and base) The definition must either use an extra equation for the empty list case: zipConsecutives [] = [] zipConsecutives xs = zip xs (tail xs) which makes it non practical to define inline at each use site. Or one may omit the empty list equation, which is safe (thanks to laziness), but that may not be immediately obvious. (It wasn't to me anyway.) The tail function is generally considered unsafe so it is not desirable to force the user to use it. The proposed functions would offer an alternative. The Data.List module is often imported unqualified, so new identifiers may cause collissions. I do find it rather unlikely that the proposed names would cause such problems, however. Deadline for discussion: 2016-05-31. _______________________________________________ Libraries mailing list Libraries at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries -------------- next part -------------- An HTML attachment was scrubbed... URL: From v.dijk.bas at gmail.com Wed Apr 13 10:43:17 2016 From: v.dijk.bas at gmail.com (Bas van Dijk) Date: Wed, 13 Apr 2016 12:43:17 +0200 Subject: [Haskell-cafe] LumiGuide is hiring Message-ID: Dear Haskellers, We're hiring a Haskell engineer to join our software engineering team. LumiGuide develops parking guidance systems for cars and bicycles. Our technology is based on optical detection techniques (Computer Vision). A nice example of one of our projects is the P-route Bicycle in Utrecht City. Functional Programming is used extensively at LumiGuide. Haskell, GHCJS and the Nix stack (Nix, NixOS, hydra and nixops) are some of the technologies we're using. I recently gave a talk at the Dutch Functional Programming Day that highlights some of the products and tools we're developing. We're looking for an experienced Haskell developer who wants to join our team full-time and will work from our office in Nijmegen, The Netherlands. As one of the first engineers you'll have a big impact on the culture and the technological direction of the company. If you're interested, please send a mail to bas at lumiguide.nl and tell me a bit about your experience (previous jobs, open source projects, things that you made that you're proud of, etc.). Best Regards, Bas van Dijk CTO LumiGuide -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Wed Apr 13 11:42:32 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Wed, 13 Apr 2016 17:12:32 +0530 Subject: [Haskell-cafe] Finding way around libraries (was parsec reorganization) Message-ID: On Wed, Mar 30, 2016 at 10:06 PM, Joe Hillenbrand wrote: > Parsec isn't as maintained as Megaparsec > . > > I recommend checking out the tutorials here > . > So under the advice to use megaparsec instead of parsec, I tried the examples here: https://mrkkrp.github.io/megaparsec/tutorials/fun-with-the-recovery-feature.html Got a page full of errors starting: fpl.hs:42:20: Not in scope: ?<$>? ? Perhaps you meant one of these: On a hunch I changed import Control.Applicative (empty) to import Control.Applicative and then it started working. I can only expect that if megaparsec's own official tutorials are thus out of sync with current haskell, then parsec's will be even more so. Also I find no megaparsec on hoogle/hayoo So how does one go about handling the dilemma: - megaparsec : in development but undocumented on hayoo/hoohle - parsec : documented but bitrotten What/how do haskell pros go about handling such Thanks Rusi -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed Apr 13 11:48:15 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 13 Apr 2016 12:48:15 +0100 Subject: [Haskell-cafe] Finding way around libraries (was parsec reorganization) In-Reply-To: References: Message-ID: <20160413114815.GG30708@weber> On Wed, Apr 13, 2016 at 05:12:32PM +0530, Rustom Mody wrote: > I tried the examples here: > > https://mrkkrp.github.io/megaparsec/tutorials/fun-with-the-recovery-feature.html > > Got a page full of errors starting: > > fpl.hs:42:20: Not in scope: ?<$>? ? > Perhaps you meant one of these: > > On a hunch I changed > import Control.Applicative (empty) > to > import Control.Applicative > > and then it started working. > I can only expect that if megaparsec's own official tutorials are thus out > of sync with current haskell, then parsec's will be even more so. On the contrary, you are out of sync with current Haskell :) <$> is in the latest Prelude. Still, best practices should mandate that tutorials support earlier releases of Haskell too, to avoid these types of confusion. > Also I find no megaparsec on hoogle/hayoo I recommend the Hoogle provided by Stackage. It searches more packages by default, including megaparsec. https://www.stackage.org/ (Alternatively, I think there is a magic incantation to make the haskell.org Hoogle search more packages, but I don't know it). Tom From michael at snoyman.com Wed Apr 13 11:49:32 2016 From: michael at snoyman.com (Michael Snoyman) Date: Wed, 13 Apr 2016 14:49:32 +0300 Subject: [Haskell-cafe] Finding way around libraries (was parsec reorganization) In-Reply-To: References: Message-ID: On Wed, Apr 13, 2016 at 2:42 PM, Rustom Mody wrote: > On Wed, Mar 30, 2016 at 10:06 PM, Joe Hillenbrand > wrote: > >> Parsec isn't as maintained as Megaparsec >> . >> >> I recommend checking out the tutorials here >> . >> > > So under the advice to use megaparsec instead of parsec, I tried the > examples here: > https://mrkkrp.github.io/megaparsec/tutorials/fun-with-the-recovery-feature.html > > Got a page full of errors starting: > > fpl.hs:42:20: Not in scope: ?<$>? ? > Perhaps you meant one of these: > > On a hunch I changed > import Control.Applicative (empty) > to > import Control.Applicative > > and then it started working. > This specific case is most likely due to different versions of GHC being used. Since 7.10, Prelude exports <$>. To avoid these kinds of problems, I've started including Stack script interpreter lines at the beginning of examples to encode exactly which version of GHC and other packages the example was tested with. In fact, I wrote a blog post about it last week: http://www.yesodweb.com/blog/2016/04/stackifying-the-cookbook Michael > I can only expect that if megaparsec's own official tutorials are thus out > of sync with current haskell, then parsec's will be even more so. > > > Also I find no megaparsec on hoogle/hayoo > > So how does one go about handling the dilemma: > - megaparsec : in development but undocumented on hayoo/hoohle > - parsec : documented but bitrotten > > What/how do haskell pros go about handling such > > Thanks > Rusi > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johannes.waldmann at htwk-leipzig.de Wed Apr 13 12:06:06 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Wed, 13 Apr 2016 14:06:06 +0200 Subject: [Haskell-cafe] how ghc finds libgmp.so when linking Message-ID: <570E362E.4090507@htwk-leipzig.de> Hi. I have some obsolete libgmp in /usr/lib, and the correct one in /usr/local/lib, but ghc does not find it, resp., finds the /usr/lib one earlier, and this is missing some symbols /usr/local/lib/ghc-7.10.3/integ_2aU3IZNMF9a7mQ0OzsZ0dS/libHSinteger-gmp-1.0.0.0-2aU3IZNMF9a7mQ0OzsZ0dS.a(wrappers.o): In function `integer_gmp_mpn_xor_n': wrappers.c:(.text+0x1761): undefined reference to `__gmpn_xor_n' when I put ghc ... -optl -Wl,--verbose I see that: SEARCH_DIR("/usr/i486-linux-gnu/lib32"); SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32"); SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i486-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); but that's apparently not what's happening. Is ghc changing this, and how can I work around it? - J.W. From johannes.waldmann at htwk-leipzig.de Wed Apr 13 13:33:21 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Wed, 13 Apr 2016 15:33:21 +0200 Subject: [Haskell-cafe] how ghc finds libgmp.so when linking Message-ID: <570E4AA1.3080408@htwk-leipzig.de> more data: when I compile with -optl -L/usr/local/lib, then the correct library is found, when I put ("ld flags", "-L/usr/local/lib") in ghc-7.10.3/settings, then it's not, when I put ("C compiler link flags", "-L/usr/local/lib") in settings, then it is. So, I can leave it at that. But I still don't know how this came to be. I built this ghc-7.10.3 from source. - J.W. From jake.waksbaum at gmail.com Wed Apr 13 14:35:38 2016 From: jake.waksbaum at gmail.com (Jake) Date: Wed, 13 Apr 2016 14:35:38 +0000 Subject: [Haskell-cafe] Simple Interpreter with State Monad In-Reply-To: <5706934B.9020107@ninebynine.org> References: <5706934B.9020107@ninebynine.org> Message-ID: Thanks to everyone for the suggestions, I'm reading up on Monad transformers and I'll see where that takes me. Graham, I was also curious why your parsers return SwishStateIO ()? When I was thinking about the design, it made sense to me to separate the parser from the interperter, that is my parsers return Command, where Command is defined like this: data Command = Line D3Coord D3Coord D3Coord D3Coord D3Coord D3Coord | Circle D3Coord D3Coord D3Coord | Hermite D3Coord D3Coord D3Coord D3Coord D3Coord D3Coord D3Coord D3Coord | Bezier D3Coord D3Coord D3Coord D3Coord D3Coord D3Coord D3Coord D3Coord | Identity | Scale D3Coord D3Coord D3Coord | Translate D3Coord D3Coord D3Coord | RotateX D3Coord | RotateY D3Coord | RotateZ D3Coord | Apply | Display | Save FilePath And then, my interpreter will consume a [Command] and produce some sort of Monad. What are the advantages of doing it your way? Thanks, Jake On Thu, Apr 7, 2016 at 1:05 PM Graham Klyne wrote: > On 07/04/2016 15:29, Jake wrote:> I'm currently in a graphics class where, > in > order to provide a standard > > interface to all of our graphics libraries, we have to process small > > scripts that look like this: > [...] > > I did something like this for my Swish system, some time ago. > > Several others adapted the software, and most recently Doug Burke put the > code > in BitBucket. > > Relevant modules are > > "Scrips.hs" - originally a "parsec" based parser, but now something else, > parses > script source and returns a "SwishStateIO" monad. > > - > > https://bitbucket.org/doug_burke/swish/src/8f72b52f02fb540e8e1c26caa5036920a9ff31da/src/Swish/Script.hs?at=default&fileviewer=file-view-default > > "Monad.hs" - defines the "SwishStateIO" monad, and defines implementations > of > the primitive functions of the scripting language. It's a long time since > I > looked at this, but I think a key part of the definition is: > > type SwishStateIO a = StateT SwishState IO a > > which (if I get this right) wraps the basic state and associated > transformation > functions in an IO monad. > > - > > https://bitbucket.org/doug_burke/swish/src/8f72b52f02fb540e8e1c26caa5036920a9ff31da/src/Swish/Monad.hs?at=default&fileviewer=file-view-default > > The "compiled" script (SwishStateIO value) is run by applying it to an > initial > state; the module that pulls it all together is: > > - > > https://bitbucket.org/doug_burke/swish/src/8f72b52f02fb540e8e1c26caa5036920a9ff31da/src/Swish.hs?at=default&fileviewer=file-view-default > > ... > > I'm not sure if any of this makes any sense, but the key idea for me, way > back > when, was the capability to compile a script directly to a monadic > function that > could then be executed by function application to an initial state (in this > case, using execStateT). > > #g > -- > > > On 07/04/2016 15:29, Jake wrote: > > I'm currently in a graphics class where, in order to provide a standard > > interface to all of our graphics libraries, we have to process small > > scripts that look like this: > > > > line > > 0 0 0 1 1 1 > > circle > > 0 0 10 > > scale > > 0 0 3 > > save > > pic.png > > > > I successfully wrote a parser with attoparsec that parses the file into a > > list of Commands. Now I'm trying to process that list to produce an IO > > action, and I thought the State monad would be useful to keep track of > the > > persistent state of the shapes to draw and the transformations on them. > > > > I'm confused about how exactly to do this though. What should the type of > > my State be? Right now I have an execute function that is > > execute :: Command -> State ParseState (IO ()) > > where ParseState is a tuple of stuff. ParseState also includes an IO () > > because I wanted to be able to create multiple pictures one after > another, > > and I couldn't figure out how to access the previous result value from > > State to add on to it in the next one. > > > > So can anyone offer advice on my specific situation, or maybe a simpler > > example of how to go about writing an interpreter with the State monad? > > > > Thanks, > > Jake > > > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Wed Apr 13 15:51:06 2016 From: david.feuer at gmail.com (David Feuer) Date: Wed, 13 Apr 2016 11:51:06 -0400 Subject: [Haskell-cafe] Hugs In-Reply-To: References: Message-ID: Apparently, Eric Meijer is now teaching a large class using Hugs, which leads to many of his students asking questions about it on StackOverflow. I therefore suggest that we change the status of Hugs on the website from "is no longer in development" to "has been maintained by Eric Meijer since 2015". I think we should also include on the website a statement to the effect that people seeking help using Hugs should contact Eric Meijer directly, and provide his email address to facilitate that. Obviously, he'll need full write access to the Hugs source repo to fulfill his duties as maintainer. Yes, this is all a bit tongue-in-cheek, but I really do think that pointing students to an unmaintained language implementation (regardless of the pedagogical reasons) has negative consequences for the functional programming community as a whole. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominikbollmann at gmail.com Wed Apr 13 15:54:59 2016 From: dominikbollmann at gmail.com (Dominik Bollmann) Date: Wed, 13 Apr 2016 17:54:59 +0200 Subject: [Haskell-cafe] Using existential types from TAPL book in Haskell Message-ID: <874mb533n0.fsf@t450s.i-did-not-set--mail-host-address--so-tickle-me> Hi all, I'm currently reading Prof. Pierce's TAPL book. Reading the chapter on existential types, I've been wondering how to use existentials in Haskell. In particular, in the TAPL book there is a section on purely functional objects, which are encoded (e.g.) as follows: counter = {*Nat, { state = 5 , methods = { get = \x:Nat. x , inc = \x:Nat. succ x } } } as Counter where Counter = {?X, { state : X , methods = { get : X -> Nat , inc : X -> X } } } That is, a Counter consists of some internal state as well as methods `get` to retrieve its state and `inc` to increment it. Internally, a Counter is just implemented with a natural number. However, from the outside, we hide this fact by making its state an existential type X. Thus, we can only modify a Counter instance (e.g., counter) using its exposed methods. For example, let {X, body} = counter in body.methods.get (body.state) (see Ch 24.2 on Existential Objects for further details) I've been wondering how to write such counters in Haskell. In particular, how to write a Counter instance like the above counter that uses a concrete representation type Nat, while exposing its state to the outside world abstractly with an existential type X. I've been trying to do this, but so far I haven't succeeded... If anyone could hint me at how to do this, would help me understanding existentials better, I think :-). Cheers, Dominik. From david.feuer at gmail.com Wed Apr 13 16:24:30 2016 From: david.feuer at gmail.com (David Feuer) Date: Wed, 13 Apr 2016 12:24:30 -0400 Subject: [Haskell-cafe] Using existential types from TAPL book in Haskell In-Reply-To: <874mb533n0.fsf@t450s.i-did-not-set--mail-host-address--so-tickle-me> References: <874mb533n0.fsf@t450s.i-did-not-set--mail-host-address--so-tickle-me> Message-ID: In Haskell, this looks like data Counter where Counter :: forall x . x -> (x -> Nat) -> (x -> x) -> Counter Then getNat :: Counter -> Nat getNat (Counter x get _) = get x incNat :: Counter -> Counter incNat (Counter x get inc) = Counter (inc x) get inc simpleCounter :: Nat -> Counter simpleCounter n = Counter n id (1 +) mkCounter :: Integral n => n -> Counter mkCounter n | n < 0 = error "Counters can't be negative." | otherwise = Counter n fromIntegral (1 +) All that said, this is not a great use-case for existentials, and in Haskell you'd be better off with class Counter n where getNat :: n -> Nat step :: n -> n On Apr 13, 2016 11:53 AM, "Dominik Bollmann" wrote: > > Hi all, > > I'm currently reading Prof. Pierce's TAPL book. Reading the chapter on > existential types, I've been wondering how to use existentials in > Haskell. > > In particular, in the TAPL book there is a section on purely functional > objects, which are encoded (e.g.) as follows: > > counter = {*Nat, { state = 5 > , methods = { get = \x:Nat. x > , inc = \x:Nat. succ x } > } } as Counter > > where Counter = {?X, { state : X > , methods = { get : X -> Nat > , inc : X -> X } > } } > > That is, a Counter consists of some internal state as well as methods > `get` to retrieve its state and `inc` to increment it. > > Internally, a Counter is just implemented with a natural > number. However, from the outside, we hide this fact by making its state > an existential type X. Thus, we can only modify a Counter instance > (e.g., counter) using its exposed methods. For example, > > let {X, body} = counter in body.methods.get (body.state) > > (see Ch 24.2 on Existential Objects for further details) > > I've been wondering how to write such counters in Haskell. In > particular, how to write a Counter instance like the above counter that > uses a concrete representation type Nat, while exposing its state to the > outside world abstractly with an existential type X. I've been trying to > do this, but so far I haven't succeeded... > > If anyone could hint me at how to do this, would help me understanding > existentials better, I think :-). > > Cheers, Dominik. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From danburton.email at gmail.com Wed Apr 13 16:38:43 2016 From: danburton.email at gmail.com (Dan Burton) Date: Wed, 13 Apr 2016 09:38:43 -0700 Subject: [Haskell-cafe] Hugs In-Reply-To: References: Message-ID: Presumably the reason for using hugs is friendlier error messages for new Haskellers, or something of the sort? On Wednesday, April 13, 2016, David Feuer wrote: > Apparently, Eric Meijer is now teaching a large class using Hugs, which > leads to many of his students asking questions about it on StackOverflow. I > therefore suggest that we change the status of Hugs on the website from "is > no longer in development" to "has been maintained by Eric Meijer since > 2015". I think we should also include on the website a statement to the > effect that people seeking help using Hugs should contact Eric Meijer > directly, and provide his email address to facilitate that. Obviously, > he'll need full write access to the Hugs source repo to fulfill his duties > as maintainer. > > Yes, this is all a bit tongue-in-cheek, but I really do think that > pointing students to an unmaintained language implementation (regardless of > the pedagogical reasons) has negative consequences for the functional > programming community as a whole. > -- -- Dan Burton -------------- next part -------------- An HTML attachment was scrubbed... URL: From cma at bitemyapp.com Wed Apr 13 16:41:10 2016 From: cma at bitemyapp.com (Christopher Allen) Date: Wed, 13 Apr 2016 11:41:10 -0500 Subject: [Haskell-cafe] Hugs In-Reply-To: References: Message-ID: <0E3A0FDD-A7A4-45D6-B117-72A2EC7376EF@bitemyapp.com> That's not the real reason and the errors aren't better. > On Apr 13, 2016, at 11:38 AM, Dan Burton wrote: > > Presumably the reason for using hugs is friendlier error messages for new Haskellers, or something of the sort? > >> On Wednesday, April 13, 2016, David Feuer wrote: >> Apparently, Eric Meijer is now teaching a large class using Hugs, which leads to many of his students asking questions about it on StackOverflow. I therefore suggest that we change the status of Hugs on the website from "is no longer in development" to "has been maintained by Eric Meijer since 2015". I think we should also include on the website a statement to the effect that people seeking help using Hugs should contact Eric Meijer directly, and provide his email address to facilitate that. Obviously, he'll need full write access to the Hugs source repo to fulfill his duties as maintainer. >> >> Yes, this is all a bit tongue-in-cheek, but I really do think that pointing students to an unmaintained language implementation (regardless of the pedagogical reasons) has negative consequences for the functional programming community as a whole. >> > > > -- > -- Dan Burton > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From palotai.robin at gmail.com Wed Apr 13 17:43:31 2016 From: palotai.robin at gmail.com (Robin Palotai) Date: Wed, 13 Apr 2016 17:43:31 +0000 Subject: [Haskell-cafe] Hugs In-Reply-To: <0E3A0FDD-A7A4-45D6-B117-72A2EC7376EF@bitemyapp.com> References: <0E3A0FDD-A7A4-45D6-B117-72A2EC7376EF@bitemyapp.com> Message-ID: By the way, I have some patches around that package Hugs as a native Chrome app (via NaCL), and has a working REPL console in the browser. It could use some love - integrating with HTML5 file API or such to save/load files, packaging up and releasing on Chrome store. I'm not likely to have time for that, but if anyone is interested please ping me and will hand it over. Christopher Allen ezt ?rta (id?pont: 2016. ?pr. 13., Sze, 18:41): > That's not the real reason and the errors aren't better. > > > On Apr 13, 2016, at 11:38 AM, Dan Burton > wrote: > > Presumably the reason for using hugs is friendlier error messages for new > Haskellers, or something of the sort? > > On Wednesday, April 13, 2016, David Feuer wrote: > >> Apparently, Eric Meijer is now teaching a large class using Hugs, which >> leads to many of his students asking questions about it on StackOverflow. I >> therefore suggest that we change the status of Hugs on the website from "is >> no longer in development" to "has been maintained by Eric Meijer since >> 2015". I think we should also include on the website a statement to the >> effect that people seeking help using Hugs should contact Eric Meijer >> directly, and provide his email address to facilitate that. Obviously, >> he'll need full write access to the Hugs source repo to fulfill his duties >> as maintainer. >> >> Yes, this is all a bit tongue-in-cheek, but I really do think that >> pointing students to an unmaintained language implementation (regardless of >> the pedagogical reasons) has negative consequences for the functional >> programming community as a whole. >> > > > -- > -- Dan Burton > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Wed Apr 13 18:23:57 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Wed, 13 Apr 2016 21:23:57 +0300 Subject: [Haskell-cafe] Hugs In-Reply-To: References: Message-ID: https://twitter.com/headinthebox/status/652834731806052352 and in the thread: > This round of #FP101x we will use https://www.haskell.org/hugs/ instead of GHCi because it is not changing. - Oleg Grenrus > On 13 Apr 2016, at 19:38, Dan Burton wrote: > > Presumably the reason for using hugs is friendlier error messages for new Haskellers, or something of the sort? > > On Wednesday, April 13, 2016, David Feuer wrote: > Apparently, Eric Meijer is now teaching a large class using Hugs, which leads to many of his students asking questions about it on StackOverflow. I therefore suggest that we change the status of Hugs on the website from "is no longer in development" to "has been maintained by Eric Meijer since 2015". I think we should also include on the website a statement to the effect that people seeking help using Hugs should contact Eric Meijer directly, and provide his email address to facilitate that. Obviously, he'll need full write access to the Hugs source repo to fulfill his duties as maintainer. > > Yes, this is all a bit tongue-in-cheek, but I really do think that pointing students to an unmaintained language implementation (regardless of the pedagogical reasons) has negative consequences for the functional programming community as a whole. > > > > -- > -- Dan Burton > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From fa-ml at ariis.it Wed Apr 13 19:33:49 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Wed, 13 Apr 2016 21:33:49 +0200 Subject: [Haskell-cafe] Hugs In-Reply-To: <0E3A0FDD-A7A4-45D6-B117-72A2EC7376EF@bitemyapp.com> References: <0E3A0FDD-A7A4-45D6-B117-72A2EC7376EF@bitemyapp.com> Message-ID: <20160413193349.GA11811@casa.casa> On Wed, Apr 13, 2016 at 11:41:10AM -0500, Christopher Allen wrote: > > On Apr 13, 2016, at 11:38 AM, Dan Burton wrote: > > > > Presumably the reason for using hugs is friendlier error messages for > > new Haskellers, or something of the sort? > > That's not the real reason and the errors aren't better. Indeed not the real reason (he wants/ed something that didn't change often -- hugs, a haskell 98 interpreter, apparently fits his bill), but I think there is some value in Hugs error reporting (tabular, slightly more concise, expression-to-type instead of type-to-expression). I think there was even a discussion on Trac but now I cannot fish it. ?> and True :23:5: Couldn't match expected type ?t0 Bool? with actual type ?Bool? In the first argument of ?and?, namely ?True? In the expression: and True Hugs> and True ERROR - Type error in application *** Expression : and True *** Term : True *** Type : Bool *** Does not match : [Bool] From johannes.waldmann at htwk-leipzig.de Wed Apr 13 21:27:02 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Wed, 13 Apr 2016 23:27:02 +0200 Subject: [Haskell-cafe] Hugs Message-ID: <570EB9A6.3080006@htwk-leipzig.de> > https://twitter.com/headinthebox/status/652834731806052352 This mentions and :: Foldable t => t Bool -> Bool as an example of "abstract nonsense". Well, I will run into teaching this soon myself, though not to freshmen - my students had some Java before but not Haskell. With regards to the type of "and", I will first have them write "data List a = ..." and a concrete "and :: List Bool -> Bool" from scratch. Later, to explain the type of "the true and" I will claim that the corresponding Java method would have type "static Boolean and (Iterable xs)" where Iterable<> is an interface (that the students should know). That's not too bad: xs.iterator() corresponds to toList xs (a lazy stream). "toList" would even be a complete definition for the Foldable instance? (since foldr f z = foldr f z . toList ) So perhaps "Foldable \approx Iterable \approx Enumerable" is a useful guideline. (Yes, there is a difference between a one-argument type class and an interface. But they have some common use cases.) - J.W. From david.feuer at gmail.com Wed Apr 13 21:42:01 2016 From: david.feuer at gmail.com (David Feuer) Date: Wed, 13 Apr 2016 17:42:01 -0400 Subject: [Haskell-cafe] Lazy monadic queues Message-ID: I've come up with a very simple implementation of lazy monadic queues based loosely on ideas from Leon P. Smith's control-monad-queue package. This implementation ties a similar sort of lazy knot, but avoids the complexity and strictness of continuation-passing style. I'm curious whether something similar is already available on Hackage, and, if not, whether it would be useful enough to package it. The source code can currently be found at https://gist.github.com/treeowl/5c14a43869cf14a823473ec075788a74 David Feuer From amindfv at gmail.com Thu Apr 14 00:13:59 2016 From: amindfv at gmail.com (amindfv at gmail.com) Date: Wed, 13 Apr 2016 20:13:59 -0400 Subject: [Haskell-cafe] [ANN] Vivid 0.2 Message-ID: After about a year of blood, sweat, and tears, the new Vivid is out! This gets us to a pretty polished state and updates will now be much more frequent. What is Vivid? It's a library to create music (and other sound) using the SuperCollider synth engine -- a really powerful audio "rendering engine." Vivid lets you create and alter music in real time, or render audio files faster than real time. It's been used in live performances (not only by me!), and I'm very happy with its sound, its power, and its expressivity. Without further ado: http://hackage.haskell.org/package/vivid Happy hacking! Tom From valor at list.ru Thu Apr 14 10:05:53 2016 From: valor at list.ru (Dmitry Chugunov) Date: Thu, 14 Apr 2016 13:05:53 +0300 Subject: [Haskell-cafe] Haskell, stack and the Atom editor In-Reply-To: References: Message-ID: <570F6B81.1040505@list.ru> Hello. I have recently started to use Atom from Haskell programming. I think it works good. I use this (main) packages: * language-haskell * haskell-ghc-mod * ide-haskell * ide-haskell-stack * ide-haskell-repl (in settings =ghci, =stack) * ide-haskell-hastags * autocomplete-haskell From rustompmody at gmail.com Thu Apr 14 12:35:01 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Thu, 14 Apr 2016 18:05:01 +0530 Subject: [Haskell-cafe] Hugs In-Reply-To: <570EB9A6.3080006@htwk-leipzig.de> References: <570EB9A6.3080006@htwk-leipzig.de> Message-ID: On Thu, Apr 14, 2016 at 2:57 AM, Johannes Waldmann < johannes.waldmann at htwk-leipzig.de> wrote: > > https://twitter.com/headinthebox/status/652834731806052352 > > This mentions and :: Foldable t => t Bool -> Bool > as an example of "abstract nonsense". > > I find it sad... that people like Erik Meijer, Mark Lentczer... (even Doug McIllroy recently demonstrated that there are 2?? dialects of haskell!!) are not being heeded And this complaint could be greatly alleviated with one little leaf drawn from racket -- language-packs: teachpacks Along with the single lightweight directive #lang It may naturally be asked how is #lang different from ghc's language "-X" options A teachpack would be a bunch of coherent -X options maybe along with a suitable prelude -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominic at steinitz.org Thu Apr 14 12:48:57 2016 From: dominic at steinitz.org (Dominic Steinitz) Date: Thu, 14 Apr 2016 12:48:57 +0000 (UTC) Subject: [Haskell-cafe] how ghc finds libgmp.so when linking References: <570E4AA1.3080408@htwk-leipzig.de> Message-ID: Johannes Waldmann htwk-leipzig.de> writes: > > more data: > > when I compile with -optl -L/usr/local/lib, > then the correct library is found, > > when I put ("ld flags", "-L/usr/local/lib") > in ghc-7.10.3/settings, then it's not, > > when I put ("C compiler link flags", "-L/usr/local/lib") > in settings, then it is. > > So, I can leave it at that. > But I still don't know how this came to be. > I built this ghc-7.10.3 from source. > > - J.W. > I get ld: warning: directory not found for option '-L/opt/local/lib/' when using hmatrix but I have no idea why. Perhaps the error messages are not related. From alois.cochard at gmail.com Thu Apr 14 15:11:31 2016 From: alois.cochard at gmail.com (Alois Cochard) Date: Thu, 14 Apr 2016 17:11:31 +0200 Subject: [Haskell-cafe] Hugs In-Reply-To: References: <570EB9A6.3080006@htwk-leipzig.de> Message-ID: I don't think it's fair to say it's not being heeded, a few folks proposed solution including usage of custom prelude and such... which seems quite similar to that feature from Racket you mention (delta the the extension thing, but solution can be found if there is enough interest for it). I feel like with a bit of good will we could go a long way. Cheers On 14 April 2016 at 14:35, Rustom Mody wrote: > On Thu, Apr 14, 2016 at 2:57 AM, Johannes Waldmann < > johannes.waldmann at htwk-leipzig.de> wrote: > >> > https://twitter.com/headinthebox/status/652834731806052352 >> >> This mentions and :: Foldable t => t Bool -> Bool >> as an example of "abstract nonsense". >> >> > I find it sad... that people like Erik Meijer, Mark Lentczer... (even Doug > McIllroy recently demonstrated that there are 2?? dialects of haskell!!) > are not being heeded > And this complaint could be greatly alleviated with one little leaf drawn > from racket -- language-packs: teachpacks > > Along with the single lightweight directive #lang > > > It may naturally be asked how is #lang different from ghc's language "-X" > options > A teachpack would be a bunch of coherent -X options maybe along with a > suitable prelude > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- *?\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From cdsmith at gmail.com Thu Apr 14 16:38:36 2016 From: cdsmith at gmail.com (Chris Smith) Date: Thu, 14 Apr 2016 09:38:36 -0700 Subject: [Haskell-cafe] Hugs In-Reply-To: References: <570EB9A6.3080006@htwk-leipzig.de> Message-ID: I suspect this wouldn't actually address too many of these concerns. Perhaps it would work for Eric's case, where he's willing to use Hugs, which is definitely not a realistic development tool anyway. Outside of that, I think it's a bit revisionist to cast concerns about recent language development as being about wanting a teaching sublanguage for new programmers. A lot of the rest of the concern is actually people's belief that Haskell is becoming too complex to be the right trade-off for general-purpose software development. New programmers are mentioned because some percentage of a realistic software engineering setting is *always* made up of new programmers, and programmers who are new to the tools or language. That isn't addressed by adding teaching modes; you can't partition off your coworkers and relegate them to the teaching dialect. For what it's worth, it's already not too hard to build simplified dialects of Haskell for teaching. I did it with http://code.world, and ran into few problems despite some big changes. In my view, it doesn't matter much if there's a single short directive to make it work with the ghc command line. There are plenty of other advantages to wrapping GHC for education. Once you've crossed the gulf from "the Haskell that everyone uses" to "special island only for teaching new programmers", you've already lost the benefits of living in the core Haskell ecosystem, and it no longer matters if you add a few differences here and there. On Thu, Apr 14, 2016 at 5:35 AM, Rustom Mody wrote: > On Thu, Apr 14, 2016 at 2:57 AM, Johannes Waldmann < > johannes.waldmann at htwk-leipzig.de> wrote: > >> > https://twitter.com/headinthebox/status/652834731806052352 >> >> This mentions and :: Foldable t => t Bool -> Bool >> as an example of "abstract nonsense". >> >> > I find it sad... that people like Erik Meijer, Mark Lentczer... (even Doug > McIllroy recently demonstrated that there are 2?? dialects of haskell!!) > are not being heeded > And this complaint could be greatly alleviated with one little leaf drawn > from racket -- language-packs: teachpacks > > Along with the single lightweight directive #lang > > > It may naturally be asked how is #lang different from ghc's language "-X" > options > A teachpack would be a bunch of coherent -X options maybe along with a > suitable prelude > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From doug at cs.dartmouth.edu Fri Apr 15 02:05:12 2016 From: doug at cs.dartmouth.edu (Doug McIlroy) Date: Thu, 14 Apr 2016 22:05:12 -0400 Subject: [Haskell-cafe] Hugs Message-ID: <201604150205.u3F25ClP099338@tahoe.cs.Dartmouth.EDU> > I really do think that pointing students to an unmaintained language > implementation (regardless of the pedagogical reasons) has negative > consequences for the functional programming community as a whole. If it works, maintenance doesn't matter. So, I assume the real concern is that Hugs isn't evolving. To put it in the worst light, this may be read as a complaint that Hugs doesn't keep up with some party line. I would hate to think that the "community as a whole" is that conformist. The disdain for "pedagogical reasons" brushes aside an implicit wakeup call to the community. Hugs is attractive because it is well described and bounded, whereas Haskell realized in GHC lacks a coherent description and presents a myriad of often inscrutable faces. To the extent that the community is defined by such an artifact, it has turned away from educators, not vice versa. Learning how to wrangle a marvelous, but cantankerous, beast should not be confounded with initiation to the insights of functional programming. Doug McIlroy From targen at gmail.com Fri Apr 15 04:16:27 2016 From: targen at gmail.com (=?UTF-8?Q?Manuel_G=C3=B3mez?=) Date: Thu, 14 Apr 2016 23:46:27 -0430 Subject: [Haskell-cafe] Hugs In-Reply-To: <201604150205.u3F25ClP099338@tahoe.cs.Dartmouth.EDU> References: <201604150205.u3F25ClP099338@tahoe.cs.Dartmouth.EDU> Message-ID: On Thu, Apr 14, 2016 at 9:35 PM, Doug McIlroy wrote: > The disdain for "pedagogical reasons" brushes aside an implicit wakeup > call to the community. I use GHC 7.10 to teach Haskell for pedagogical reasons. There is no consensus on the pedagogical virtue of the most recent changes to the compiler and base libraries, but a good portion of us happen to prefer and achieve apparently good results teaching post-AMP, post-FTP Haskell with various GHC extensions. > Hugs is attractive because it is well described and bounded, whereas > Haskell realized in GHC lacks a coherent description and presents > a myriad of often inscrutable faces. Haskell 98 has many qualities that can be understood as shortcomings resulting from historical accidents, and the current realization of Haskell in GHC fixes several of those. Yet more arguable infelicities are solved by teaching to a certain set of language extensions, some even quite recent. Avoiding these problems has pedagogical benefits. Although precise, coherent descriptions are available for Haskell 98 and Haskell 2010 for reference in the Reports, the documentation shipped by GHC for many language extensions is often reasonably close in precision and coherence, as far as many students are concerned ? and, more importantly, the learning process for a student rarely involves consuming a precise, coherent definition, and often involves a greater degree of experimentation and consumption of explanations aimed to teach, not to serve as reference for language implementors. I do not aim to suggest that standards are not useful ?they surely are?, but standards are of limited use to many students. > Learning how to wrangle a marvelous, but cantankerous, beast should not > be confounded with initiation to the insights of functional programming. In any case, an initiation to the insights of functional programming surely must not begin with a general-purpose programming language adequate for industrial application, but rather with a discussion of the nature of functional programming supported by a review of the theory upon which it is founded: at the very least, the lambda calculus, preferably along with some basic ideas from type theory. Programming in a number of concrete languages is helpful for this: some modern descendent of LISP, perhaps some proof assistant over a functional language, and indeed, some Haskell. If these students are to become industrial practitioners, it serves them well to teach GHC Haskell to illustrate one facet of the complex industrial side of functional programming. This, indeed, is not quite adequate for the most basic bits of an initiation ? and that is fine. From ok at cs.otago.ac.nz Fri Apr 15 07:06:38 2016 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Fri, 15 Apr 2016 19:06:38 +1200 Subject: [Haskell-cafe] Hugs In-Reply-To: References: <201604150205.u3F25ClP099338@tahoe.cs.Dartmouth.EDU> Message-ID: <84ac9580-85f2-f73c-0b7c-a164beb124f4@cs.otago.ac.nz> On 15/04/16 4:16 pm, Manuel G?mez wrote: > Although precise, coherent descriptions are available for Haskell 98 > and Haskell 2010 for reference in the Reports, the documentation > shipped by GHC for many language extensions is often reasonably close > in precision and coherence, as far as many students are concerned ? > and, more importantly, the learning process for a student rarely > involves consuming a precise, coherent definition, and often involves > a greater degree of experimentation and consumption of explanations > aimed to teach, not to serve as reference for language implementors. > > I do not aim to suggest that standards are not useful ?they surely > are?, but standards are of limited use to many students. I'm reminded of a Prolog textbook that was written with much thought and care, diligently adhering scrupulously to the then-current draft of the ISO Prolog standard, and tested in a Prolog implementation written to conform to it. The book ended up being useless because the standard changed to be somewhat less of a complete break from the past, so eventually there were *no* Prolog systems compatible with the book. Students themselves mostly do not know or care what the standard is. What they *are* affected by is whether their teaching materials agree with the implementation they are using. From Lennart.Augustsson at sc.com Fri Apr 15 08:09:00 2016 From: Lennart.Augustsson at sc.com (Augustsson, Lennart) Date: Fri, 15 Apr 2016 08:09:00 +0000 Subject: [Haskell-cafe] Hugs In-Reply-To: <201604150205.u3F25ClP099338@tahoe.cs.Dartmouth.EDU> References: <201604150205.u3F25ClP099338@tahoe.cs.Dartmouth.EDU> Message-ID: <22B950C955F8AB4196E72698FBD00002D02F38DE@UKWPIPXMB01C.zone1.scb.net> Very well put! -----Original Message----- From: Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Doug McIlroy Sent: 15 April 2016 03:05 To: haskell-cafe at haskell.org Subject: Re: [Haskell-cafe] Hugs > I really do think that pointing students to an unmaintained language > implementation (regardless of the pedagogical reasons) has negative > consequences for the functional programming community as a whole. If it works, maintenance doesn't matter. So, I assume the real concern is that Hugs isn't evolving. To put it in the worst light, this may be read as a complaint that Hugs doesn't keep up with some party line. I would hate to think that the "community as a whole" is that conformist. The disdain for "pedagogical reasons" brushes aside an implicit wakeup call to the community. Hugs is attractive because it is well described and bounded, whereas Haskell realized in GHC lacks a coherent description and presents a myriad of often inscrutable faces. To the extent that the community is defined by such an artifact, it has turned away from educators, not vice versa. Learning how to wrangle a marvelous, but cantankerous, beast should not be confounded with initiation to the insights of functional programming. Doug McIlroy _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at http://www.standardchartered.com/en/incorporation-details.html Insofar as this communication contains any market commentary, the market commentary has been prepared by sales and/or trading desk of Standard Chartered Bank or its affiliate. It is not and does not constitute research material, independent research, recommendation or financial advice. Any market commentary is for information purpose only and shall not be relied for any other purpose, and is subject to the relevant disclaimers available at http://wholesalebanking.standardchartered.com/en/utility/Pages/d-mkt.aspx Insofar as this e-mail contains the term sheet for a proposed transaction, by responding affirmatively to this e-mail, you agree that you have understood the terms and conditions in the attached term sheet and evaluated the merits and risks of the transaction. We may at times also request you to sign on the term sheet to acknowledge in respect of the same. Please visit http://wholesalebanking.standardchartered.com/en/capabilities/financialmarkets/Pages/doddfrankdisclosures.aspx for important information with respect to derivative products. From johannes.waldmann at htwk-leipzig.de Fri Apr 15 08:20:59 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Fri, 15 Apr 2016 10:20:59 +0200 Subject: [Haskell-cafe] Hugs Message-ID: <5710A46B.5060103@htwk-leipzig.de> > the learning process for a student rarely > involves consuming a precise, coherent definition, But it should! I do make a point of embedding references to actual standards in my teaching, mostly in exercises like "what paragraph of the (e.g., Java) language spec. says that the following program is illegal". The intention is: students should a) get used to reading (semi-)formal specifications b) see that concepts from "theory" (lecture, papers) appear verbatim in actual "industrial" specs c) get scared of using software/language that has no specification > .. the nature of functional programming supported by a review of the > theory upon which it is founded: at the very least, the lambda > calculus, preferably along with some basic ideas from type theory. That. And I do start my FP teaching with term rewriting, as a model of first-order programming. (gives you terms as a model of data, and rewrite rule application as a model of pattern matching) - J.W. From code at funwithsoftware.org Fri Apr 15 17:53:13 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Fri, 15 Apr 2016 10:53:13 -0700 Subject: [Haskell-cafe] Haskell on OpenWRT In-Reply-To: References: <5708B534.9010109@funwithsoftware.org> <20160409084618.4378706.35395.3068@amok.cc> <570AB023.1010900@funwithsoftware.org> <570D3FD7.8080701@funwithsoftware.org> Message-ID: <57112A89.3010008@funwithsoftware.org> On 4/12/16 11:54 AM, Tomas Carnecky wrote: > ncurses is the only library. > > Not sure how I managed to configure the crosscompiler to produce > static binaries, maybe it was an option which I had to pass to GHC. In > any case, here's a docker image which includes instructions how I > build the cross compiler: > https://github.com/wereHamster/onion-omega/tree/master/xt, and here's > a docker image which builds on top of that to compile a > cross-compiling GHC: > https://github.com/wereHamster/onion-omega/tree/master/ghc. Thanks for all your help! I now have my ghc cross-compiler working, and I can run simple programs on the OpenWRT box! However, in order to build nontrivial programs, I need cabal. The GHC cross-compiling page ( https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling ) recommends: cabal --with-ghc= --with-ld= ... So I expanded this approach to: alias mcabal="cabal --with-ghc=x86_64-unknown-linux-musl-ghc --with-ld=x86_64-unknown-linux-musl-ld --with-gcc=x86_64-unknown-linux-musl-gcc --with-ghc-pkg=x86_64-unknown-linux-musl-ghc-pkg --disable-executable-dynamic" Am I on the right track with that approach? I'm able to install some packages with mcabal. (For example, "mcabal install hourglass".) But with cryptonite, I get: ppelletier at patrick64:~/src/lifx/lifx-programs$ mcabal install --flags=-integer-gmp cryptonite Resolving dependencies... Configuring memory-0.12... Building memory-0.12... Preprocessing library memory-0.12... running dist/dist-sandbox-5f352b7e/build/Data/Memory/MemMap/Posix_hsc_make failed (exit code 127) command was: dist/dist-sandbox-5f352b7e/build/Data/Memory/MemMap/Posix_hsc_make >dist/dist-sandbox-5f352b7e/build/Data/Memory/MemMap/Posix.hs Failed to install memory-0.12 cabal: Error: some packages failed to install: cryptonite-0.15 depends on memory-0.12 which failed to install. memory-0.12 failed during the building phase. The exception was: ExitFailure 1 I haven't been able to figure out exactly what's going on there. Or, "mcabal install aeson" fails with: Building aeson-0.11.1.4... Preprocessing library aeson-0.11.1.4... ghc: Data/Aeson/TH.hs:9:14-28: Template Haskell requires GHC with interpreter support Perhaps you are using a stage-1 compiler? Usage: For basic information, try the `--help' option. Failed to install aeson-0.11.1.4 cabal: Error: some packages failed to install: aeson-0.11.1.4 failed during the building phase. The exception was: ExitFailure 1 Is there a way to get Template Haskell to work? Or is that just impossible? (And therefore, cross-compiling is impossible for many of the packages on Hackage?) Is this a sign that I should have taken Lana's suggestion to use Marios's approach instead? --Patrick From alexey.muranov at gmail.com Sat Apr 16 11:53:47 2016 From: alexey.muranov at gmail.com (Alexey Muranov) Date: Sat, 16 Apr 2016 13:53:47 +0200 Subject: [Haskell-cafe] is monomorphism restriction necessary? Message-ID: <9E1C1040-0C2C-4D94-8891-15519869CFC2@gmail.com> Sorry for the question that probably is already answered somewhere, but i do not get it from the basic documentation i have looked at so far. Is monomorphism restriction really necessary, or is it just a convenience? In the example from A History of Haskell genericLength :: Num a => [b] -> a f xs = (len, len) where len = genericLength xs can't the monomorphism restriction be replaced with just adding the signature f :: Num a => [b] -> (a, a) ? If yes, are there other cases where there is no way to get the desired behavior without enabling the monomorphism restriction? Alexey. From alois.cochard at gmail.com Sat Apr 16 12:23:57 2016 From: alois.cochard at gmail.com (Alois Cochard) Date: Sat, 16 Apr 2016 14:23:57 +0200 Subject: [Haskell-cafe] [ANN] sarsi 0.0.2.0 - A universal quickfix toolkit and his protocol (nvim/vim) Message-ID: Hello Caf?, Here is a new tool which should basically improve the "quick fixing" experience in Haskell with vim/neovim. The aim is not to replace any of the great features provided by integrating the type checker in the editor, but to complement them with a different approach. I explain the motivation there: http://aloiscochard.blogspot.ch/2016/04/quickfix-all-things-with-sarsi.html If you feel like this might be a tool for you, you can jump straight to the README to find the install and usage instructions: https://github.com/aloiscochard/sarsi I did test it extensively with stack, let me know if you have issues using an other tool (I do only pipe stderr which is fine for stack, I suspect this might not be the case for others). Thanks -- *?\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sat Apr 16 12:28:56 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sat, 16 Apr 2016 13:28:56 +0100 Subject: [Haskell-cafe] [ANN] sarsi 0.0.2.0 - A universal quickfix toolkit and his protocol (nvim/vim) In-Reply-To: References: Message-ID: <20160416122856.GC30708@weber> On Sat, Apr 16, 2016 at 02:23:57PM +0200, Alois Cochard wrote: > Here is a new tool which should basically improve the "quick fixing" > experience in Haskell with vim/neovim. Excuse my ignorance, but what is "quick fixing", exactly? From alois.cochard at gmail.com Sat Apr 16 12:57:03 2016 From: alois.cochard at gmail.com (Alois Cochard) Date: Sat, 16 Apr 2016 14:57:03 +0200 Subject: [Haskell-cafe] [ANN] sarsi 0.0.2.0 - A universal quickfix toolkit and his protocol (nvim/vim) In-Reply-To: <20160416122856.GC30708@weber> References: <20160416122856.GC30708@weber> Message-ID: It's a concept you'll find in vi/vim which it seems was borrowed from the Manx's Aztec C compiler on the Amiga. A "quickfix" is basically an item (error or warning) returned by the compiler/build tool and correspond to a special mode, in editor supporting it, which allows to jump quickly from one error to the other. You can find more information about this in the vim documentation: http://vimdoc.sourceforge.net/htmldoc/quickfix.html Hope that clarify On 16 April 2016 at 14:28, Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Sat, Apr 16, 2016 at 02:23:57PM +0200, Alois Cochard wrote: > > Here is a new tool which should basically improve the "quick fixing" > > experience in Haskell with vim/neovim. > > Excuse my ignorance, but what is "quick fixing", exactly? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- *?\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.trstenjak at gmail.com Sat Apr 16 13:49:03 2016 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Sat, 16 Apr 2016 15:49:03 +0200 Subject: [Haskell-cafe] [ANN] sarsi 0.0.2.0 - A universal quickfix toolkit and his protocol (nvim/vim) In-Reply-To: References: Message-ID: <20160416134903.GA2246@octa> Hi Alois, I think that I know vim and the Haskell development environment quite well, but have a hard time to get what sarsi really is. It seems to be something about running a compiler (continuously?) and saving the error messages per file? In the documentation a motivation might be missing like e.g. what it does beyond - or better than - the vim integrations of ghc-mod oder hdevtools? Greetings, Daniel From roma at ro-che.info Sat Apr 16 15:49:15 2016 From: roma at ro-che.info (Roman Cheplyaka) Date: Sat, 16 Apr 2016 18:49:15 +0300 Subject: [Haskell-cafe] is monomorphism restriction necessary? In-Reply-To: <9E1C1040-0C2C-4D94-8891-15519869CFC2@gmail.com> References: <9E1C1040-0C2C-4D94-8891-15519869CFC2@gmail.com> Message-ID: <57125EFB.2010209@ro-che.info> On 04/16/2016 02:53 PM, Alexey Muranov wrote: > Sorry for the question that probably is already answered somewhere, but i do not get it from the basic documentation i have looked at so far. > > Is monomorphism restriction really necessary, or is it just a convenience? > > In the example from A History of Haskell > > genericLength :: Num a => [b] -> a > > f xs = (len, len) > where > len = genericLength xs > > can't the monomorphism restriction be replaced with just adding the signature > > f :: Num a => [b] -> (a, a) > > ? No; the let binding 'len' would still generalize. It would generalize even if you assigned 'f' a monotype such as [b] -> (Int, Int). Now, the compiler *could* later realize that the polymorphic value 'len' is evaluated twice at the same type and perform a CSE, but I guess the standard authors were not comfortable with *requiring* that kind of optimization from all compliant compilers. Of course, nowadays we have scoped type variables, so MR is no longer strictly necessary. Sometimes it is desirable in that it gives the behavior that you would intuitively expect; sometimes, the opposite. Roman From alois.cochard at gmail.com Sat Apr 16 15:57:57 2016 From: alois.cochard at gmail.com (Alois Cochard) Date: Sat, 16 Apr 2016 17:57:57 +0200 Subject: [Haskell-cafe] [ANN] sarsi 0.0.2.0 - A universal quickfix toolkit and his protocol (nvim/vim) In-Reply-To: <20160416134903.GA2246@octa> References: <20160416134903.GA2246@octa> Message-ID: Hi Daniel, I thought that the motivation part in the blog post would answer that, seems like it's not enough. http://aloiscochard.blogspot.ch/2016/04/quickfix-all-things-with-sarsi.html You see, when you use ghc-mod or other similar integration of the like, it usually type check the code in your active project, but such tools doesn't have a complete vision of your project (like source dependencies as mentioned in the blog post). Due to that, the error reported in ghc-mod/... might be different (and sometime not so useful) than the one returned by the build tool. I mean I always want to fix the first error reported by my build tool, not an other one in the file I'm viewing, etc ... The motivation was to be able to populate the quickfix list using the output of the build tool (which is usually run continuously on file change, there is an example using `entr` in the README), as an alternative to using mainly the type checker. I see both as useful, but in different context. If you never felt frustrated with your current setup, you probably won't see much benefit in this approach, but personally, I am much more productive using the one *sarsi* offer. Cheers On 16 April 2016 at 15:49, Daniel Trstenjak wrote: > > Hi Alois, > > I think that I know vim and the Haskell development environment quite > well, but have a hard time to get what sarsi really is. > > It seems to be something about running a compiler (continuously?) > and saving the error messages per file? > > In the documentation a motivation might be missing like e.g. what it > does beyond - or better than - the vim integrations of ghc-mod oder > hdevtools? > > Greetings, > Daniel > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- *?\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexey.muranov at gmail.com Sat Apr 16 19:22:04 2016 From: alexey.muranov at gmail.com (Alexey Muranov) Date: Sat, 16 Apr 2016 12:22:04 -0700 (PDT) Subject: [Haskell-cafe] is monomorphism restriction necessary? In-Reply-To: <57125EFB.2010209@ro-che.info> References: <9E1C1040-0C2C-4D94-8891-15519869CFC2@gmail.com> <57125EFB.2010209@ro-che.info> Message-ID: <331578bd-501c-4a45-a499-8955d222f66c@googlegroups.com> On Saturday, April 16, 2016 at 5:49:24 PM UTC+2, Roman Cheplyaka wrote: > > On 04/16/2016 02:53 PM, Alexey Muranov wrote: > > Sorry for the question that probably is already answered somewhere, but > i do not get it from the basic documentation i have looked at so far. > > > > Is monomorphism restriction really necessary, or is it just a > convenience? > > > > In the example from A History of Haskell > > > > genericLength :: Num a => [b] -> a > > > > f xs = (len, len) > > where > > len = genericLength xs > > > > can't the monomorphism restriction be replaced with just adding the > signature > > > > f :: Num a => [b] -> (a, a) > > > > ? > > No; the let binding 'len' would still generalize. It would generalize > even if you assigned 'f' a monotype such as [b] -> (Int, Int). > > Now, the compiler *could* later realize that the polymorphic value 'len' > is evaluated twice at the same type and perform a CSE, but I guess the > standard authors were not comfortable with *requiring* that kind of > optimization from all compliant compilers. > > Of course, nowadays we have scoped type variables, so MR is no longer > strictly necessary. Sometimes it is desirable in that it gives the > behavior that you would intuitively expect; sometimes, the opposite. > > Roman Thank you, i will think about it, though i don't understand yet. Could you show me, please, how to use scoped type variables to avoid MR in this example? Alexey. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alois.cochard at gmail.com Sat Apr 16 19:36:28 2016 From: alois.cochard at gmail.com (Alois Cochard) Date: Sat, 16 Apr 2016 21:36:28 +0200 Subject: [Haskell-cafe] [ANN] sarsi 0.0.2.0 - A universal quickfix toolkit and his protocol (nvim/vim) In-Reply-To: References: <20160416134903.GA2246@octa> Message-ID: For those for who are yet not clear on what the hell this tool is doing, here is a screencast showing a one minute fixing session using stack: https://media.giphy.com/media/3o6ozkwoL7wHOjer9C/giphy.gif On 16 April 2016 at 17:57, Alois Cochard wrote: > Hi Daniel, > > I thought that the motivation part in the blog post would answer that, > seems like it's not enough. > http://aloiscochard.blogspot.ch/2016/04/quickfix-all-things-with-sarsi.html > > You see, when you use ghc-mod or other similar integration of the like, it > usually type check the code in your active project, but such tools doesn't > have a complete vision of your project (like source dependencies as > mentioned in the blog post). Due to that, the error reported in ghc-mod/... > might be different (and sometime not so useful) than the one returned by > the build tool. I mean I always want to fix the first error reported by my > build tool, not an other one in the file I'm viewing, etc ... > > The motivation was to be able to populate the quickfix list using the > output of the build tool (which is usually run continuously on file change, > there is an example using `entr` in the README), as an alternative to using > mainly the type checker. I see both as useful, but in different context. > > If you never felt frustrated with your current setup, you probably won't > see much benefit in this approach, but personally, I am much more > productive using the one *sarsi* offer. > > Cheers > > > > On 16 April 2016 at 15:49, Daniel Trstenjak > wrote: > >> >> Hi Alois, >> >> I think that I know vim and the Haskell development environment quite >> well, but have a hard time to get what sarsi really is. >> >> It seems to be something about running a compiler (continuously?) >> and saving the error messages per file? >> >> In the documentation a motivation might be missing like e.g. what it >> does beyond - or better than - the vim integrations of ghc-mod oder >> hdevtools? >> >> Greetings, >> Daniel >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > > > -- > *?\ois* > http://twitter.com/aloiscochard > http://github.com/aloiscochard > -- *?\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Sat Apr 16 20:10:28 2016 From: roma at ro-che.info (Roman Cheplyaka) Date: Sat, 16 Apr 2016 23:10:28 +0300 Subject: [Haskell-cafe] is monomorphism restriction necessary? In-Reply-To: <331578bd-501c-4a45-a499-8955d222f66c@googlegroups.com> References: <9E1C1040-0C2C-4D94-8891-15519869CFC2@gmail.com> <57125EFB.2010209@ro-che.info> <331578bd-501c-4a45-a499-8955d222f66c@googlegroups.com> Message-ID: <57129C34.8050601@ro-che.info> On 04/16/2016 10:22 PM, Alexey Muranov wrote: > Could you show me, please, how to use scoped type variables to avoid MR > in this example? All MR does is it prevents a binding from being generalized. Another way to achieve that would be to give that binding a (monomorphic) type signature. Without scoped t.v., you can't give a signature to 'len' while keeping 'f' polymorphic in the return type. With scoped t.v., you can: f :: forall a b . Num a => [b] -> (a,a) f xs = (len, len) where len :: a len = genericLength xs Roman From alexey.muranov at gmail.com Sat Apr 16 20:23:28 2016 From: alexey.muranov at gmail.com (Alexey Muranov) Date: Sat, 16 Apr 2016 13:23:28 -0700 (PDT) Subject: [Haskell-cafe] is monomorphism restriction necessary? In-Reply-To: <57129C34.8050601@ro-che.info> References: <9E1C1040-0C2C-4D94-8891-15519869CFC2@gmail.com> <57125EFB.2010209@ro-che.info> <331578bd-501c-4a45-a499-8955d222f66c@googlegroups.com> <57129C34.8050601@ro-che.info> Message-ID: <063551ab-8ca5-48d6-a9cd-604b865d7f5a@googlegroups.com> On Saturday, April 16, 2016 at 10:10:37 PM UTC+2, Roman Cheplyaka wrote: > > On 04/16/2016 10:22 PM, Alexey Muranov wrote: > > Could you show me, please, how to use scoped type variables to avoid MR > > in this example? > > All MR does is it prevents a binding from being generalized. Another way > to achieve > that would be to give that binding a (monomorphic) type signature. Without > scoped t.v., you can't give a signature to 'len' while keeping 'f' > polymorphic > in the return type. With scoped t.v., you can: > > f :: forall a b . Num a => [b] -> (a,a) > f xs = (len, len) > where > len :: a > len = genericLength xs > Great, thanks for the explanation (i'll think about it). If i have understood correctly, having scoped type variables, MR is no longer needed at all then. Alexey. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Sun Apr 17 23:14:46 2016 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Mon, 18 Apr 2016 01:14:46 +0200 Subject: [Haskell-cafe] Building shared library to be called from C In-Reply-To: References: Message-ID: On Thu, 07 Apr 2016 18:52:39 +0200, Jack Hill wrote: : > > If I try "ghc maint.c -lhfact" I get: > > /tmp/ghc19146_0/ghc_4.o: In function `main': > ghc_3.c:(.text+0x0): multiple definition of `main' > maint.o:maint.c:(.text+0x0): first defined here > /tmp/ghc19146_0/ghc_4.o: In function `main': > ghc_3.c:(.text+0x61): undefined reference to `ZCMain_main_closure' > collect2: error: ld returned 1 exit status > > How should I be calling Haskell from C? Maybe this helps: https://wiki.haskell.org/Calling_Haskell_from_C Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From code at funwithsoftware.org Mon Apr 18 06:06:59 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Sun, 17 Apr 2016 23:06:59 -0700 Subject: [Haskell-cafe] Haskell on OpenWRT In-Reply-To: References: <5708B534.9010109@funwithsoftware.org> <20160409084618.4378706.35395.3068@amok.cc> <570AB023.1010900@funwithsoftware.org> <570D3FD7.8080701@funwithsoftware.org> <57112A89.3010008@funwithsoftware.org> Message-ID: <57147983.2050200@funwithsoftware.org> On 4/17/16 4:13 PM, Henk-Jan van Tuyl wrote: > Could you create a HaskellWiki page (called OpenWRT) describing how to > do this? Or send the text to me, so that I can put it in a HaskellWiki > page. Sure. I had written some detailed text about my cross-compilation adventure for my blog, so I went ahead and used that as the starting point for the wiki page: https://wiki.haskell.org/OpenWRT It's written in a much more narrative, first-person style than is really appropriate for a wiki, so of course please feel free to edit it to make it more appropriate for that context. I also haven't linked that page from anywhere else on the wiki yet, so feel free to do that, too. --Patrick From cpdurham at gmail.com Mon Apr 18 18:45:51 2016 From: cpdurham at gmail.com (Charlie Durham) Date: Mon, 18 Apr 2016 14:45:51 -0400 Subject: [Haskell-cafe] Existential quantification of config data types Message-ID: Hi, I'm running into a weird problem i've never had before. I want to define a datatype like: data Network = forall a. Layer a => Network [a] for which I have things that implement Layer, like data TypicalLayer = ... instance Layer TypicalLayer where ... with this, I want to be able to load a Network from a config file where Network can consist of different data types all implementing Layer. Is there a nice way to do this without making a data type that combines all of my layer types, something like: data LayerType = TypicalLayerType TypicalLayer | AnotherLayerType AnotherLayer ... deriving (Show,Read) Thanks for the help! Charlie Durham -------------- next part -------------- An HTML attachment was scrubbed... URL: From dsf at seereason.com Mon Apr 18 18:56:05 2016 From: dsf at seereason.com (David Fox) Date: Mon, 18 Apr 2016 11:56:05 -0700 Subject: [Haskell-cafe] Pretty-printing haskell source code - could the line breaking be improved? Message-ID: When I pretty print a certain deleration (with default width) I get this: upeekRow _unv (_xconc@(ImageSize {})) = Node (upeekCons idPath Nothing) (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ Dimension) []) (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Dimension]))) [UPath_ImageSize_dim] ++ (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ Double) []) (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Double]))) [UPath_ImageSize_size] ++ (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ Units) []) (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Units]))) [UPath_ImageSize_units] ++ []))) However, what I would like to see is something closer to this: upeekRow _unv (_xconc@(ImageSize {})) = Node (upeekCons idPath Nothing) (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ Dimension) []) (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Dimension]))) [UPath_ImageSize_dim] ++ (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ Double) []) (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Double]))) [UPath_ImageSize_size] ++ (concatMap (\f -> forestMap (liftPeek f) (map (\x' -> Node (upeekCons idPath (Just (u x' :: Univ)) :: UPeek Univ Units) []) (toListOf (toLens (f idPath) . ulens' (Proxy :: Proxy Univ)) _xconc :: [Units]))) [UPath_ImageSize_units] ++ []))) So I guess what I'm seeing is that as it is traversing the syntax tree when it finds it is too far to the right it just inserts a line break - but since it is so far down the tree it only buys it a few spaces, whereas if it had backtracked a few levels up the tree the new position would be much further to the left. Could anyone point me towards the code that implements this decision making? I'm pretty sure it is in the display function Text.PrettyPrint.Annotated.HughesPJ, but the code there doesn't make much sense to me. Any thoughts would be appreciated. David Fox -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Mon Apr 18 19:54:44 2016 From: ben at well-typed.com (Ben Gamari) Date: Mon, 18 Apr 2016 21:54:44 +0200 Subject: [Haskell-cafe] [ANNOUNCE] GHC 8.0.1 release candidate 3 available Message-ID: <87d1pmvgjf.fsf@smart-cactus.org> Hello Haskellers, The GHC team is happy to announce the availability of third release candidate of the Glasgow Haskell Compiler's 8.0.1 release. Source and binary distributions can be found at, http://downloads.haskell.org/~ghc/8.0.1-rc3/ This is the third of what will be four candidates leading up to the 8.0.1 release. As there are a number of known issues with this candidate, we expect to produce the fourth and final release candidate shortly. While we considered not releasing this candidate at all and instead skipping to rc4, we decided that it would be helpful to make it available despite its issues to increase the likelihood of catching any remaining bugs. That being said, this candidate lacks the range of binary distributions which we usually offer, * We are unable to release Windows bindists due to a compatibility issue which we didn't catch until after preparing the source distribution. * Binaries targeting Redhat distributions are currently not available Regardless, users for whom a distribution is available are encouraged to try this candidate as it fixes dozens of issues present in release candidate two. These include, * A type-checker panic triggered by use of Typeable on a kind-polymorphic type constructor (#11334) * A type-checker explosion where -XTypeInType would gobble up massive amounts of memory when used in a data instance (#11407) * Various issues involving unexpected laziness resulting in exception handlers not being invoked (#11555) * GHC now fails more gracefully when used with an older cabal-install release (#11558) * TypeInType now has proper documentation in the users guide (#11614) * The story surrounding type `RuntimeRep`s (formerly known as `Levity`) is now far better developed, closing several doors to unsafe behavior that TypeInType previously opened (#11473, #11723) * A long-standing bug in the constant-folding rules for `mod` for the `Word` type has been resolved (#11702) * Various issues introduced by OverloadedRecordFields have been fixed (#11662, #11401) * A regression in the typechecker resulting in the rejection of code in the `free` and `microlens` packages has been fixed (#11608) * A bug in the LLVM code generator which caused some programs to emit unbuildable LLVM IR has been fixed (#11649) * A bug where pattern synonyms defined in terms of a pattern match on a record would be rejected if the fields weren't written in the same order as they were defined has been resolved (#11633) * A bug in the runtime system's treatment of weak references which could result in segmentation faults in some cases has been fixed (#11108) * a variety of optimizations improving compiler performance have been merged * and many others Mac OS X users should be aware that the recent XCode 7.3 release ships with a broken `nm` utility which breaks the GHC build (#11744, #11823). Unfortunately, this candidate does not notice this brokenness and odd behavior can result. OS X users running XCode 7.3 are encouraged to open a ticket with Apple and build GHC with the `--with-nm=nm-classic` configure option until a fix is available. As mentioned earlier, there are a number of known issues with this candidate which will be addressed in release candidate four. These issues include, * A number of typechecker bugs (#11811, #11797, #11813, #11814) * A build issue seen on OS X (#11828) * Template Haskell lacks the ability to produce instances with OVERLAPP{ING,ABLE,ED} pragmas * Autoconf has inadequate version checks for libdw (#11820) * Typeable and hs-boot files interact poorly (#11824) * The build system doesn't check for the broken Apple `nm` utility, leading to unpredictable results (#11823, #11744) We hope to have release candidate four available by the middle of next week. Thanks to everyone who has contributed code, testing, builds, and bug reports thusfar! Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From david.feuer at gmail.com Mon Apr 18 20:18:57 2016 From: david.feuer at gmail.com (David Feuer) Date: Mon, 18 Apr 2016 16:18:57 -0400 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? Message-ID: If f :: a -> IO a for some a, and I want to use mfix f then f must not inspect its argument in any way, or the computation will get stuck. In some cases, this seems a bit harsh. For example, mfix (\x -> fmap (3 :) (x `seq` readLn)) looks perfectly reasonable. There is no need to inspect the return [] action to know that the final result of the computation will begin with 3:. Is there a lazy IO mapping function somewhere that can work such magic? From david.feuer at gmail.com Mon Apr 18 20:26:08 2016 From: david.feuer at gmail.com (David Feuer) Date: Mon, 18 Apr 2016 16:26:08 -0400 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? In-Reply-To: References: Message-ID: Urk.. I mean there's no need to execute the readLn action. On Apr 18, 2016 4:18 PM, "David Feuer" wrote: > If > > f :: a -> IO a > > for some a, and I want to use > > mfix f > > then f must not inspect its argument in any way, or the computation > will get stuck. In some cases, this seems a bit harsh. For example, > > mfix (\x -> fmap (3 :) (x `seq` readLn)) > > looks perfectly reasonable. There is no need to inspect the return [] > action to know that the final result of the computation will begin > with 3:. Is there a lazy IO mapping function somewhere that can work > such magic? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Mon Apr 18 20:47:09 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Mon, 18 Apr 2016 21:47:09 +0100 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? In-Reply-To: References: Message-ID: You can't know that the final result of the computation (x `seq` (3:...)) will begin with 3, because sometimes it doesn't! More specifically, it diverges (without yielding the 3) if x diverges. I don't think this is anything special about mfix: (let x = x `seq` 3:... in x) also diverges for the same reason. Hope that helps, David On 18 Apr 2016 21:19, "David Feuer" wrote: > If > > f :: a -> IO a > > for some a, and I want to use > > mfix f > > then f must not inspect its argument in any way, or the computation > will get stuck. In some cases, this seems a bit harsh. For example, > > mfix (\x -> fmap (3 :) (x `seq` readLn)) > > looks perfectly reasonable. There is no need to inspect the return [] > action to know that the final result of the computation will begin > with 3:. Is there a lazy IO mapping function somewhere that can work > such magic? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Mon Apr 18 21:03:31 2016 From: david.feuer at gmail.com (David Feuer) Date: Mon, 18 Apr 2016 17:03:31 -0400 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? In-Reply-To: References: Message-ID: Consider the implementation of `second` for pairs: second f ~(a,b) = (a, f b) Now fix $ second (3 :) Will be (undefined, [3,3,....]) Translating this to IO, I'd want lazyMap f undefined to produce as much as possible of the result, although it cannot produce the final State# RealWorld token. On Apr 18, 2016 4:47 PM, "David Turner" wrote: > You can't know that the final result of the computation (x `seq` (3:...)) > will begin with 3, because sometimes it doesn't! More specifically, it > diverges (without yielding the 3) if x diverges. > > I don't think this is anything special about mfix: (let x = x `seq` 3:... > in x) also diverges for the same reason. > > Hope that helps, > > David > On 18 Apr 2016 21:19, "David Feuer" wrote: > >> If >> >> f :: a -> IO a >> >> for some a, and I want to use >> >> mfix f >> >> then f must not inspect its argument in any way, or the computation >> will get stuck. In some cases, this seems a bit harsh. For example, >> >> mfix (\x -> fmap (3 :) (x `seq` readLn)) >> >> looks perfectly reasonable. There is no need to inspect the return [] >> action to know that the final result of the computation will begin >> with 3:. Is there a lazy IO mapping function somewhere that can work >> such magic? >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Mon Apr 18 21:12:05 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Mon, 18 Apr 2016 22:12:05 +0100 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? In-Reply-To: References: Message-ID: Sorry, you've lost me. I suspect you're trying to give a minimal example of the problem you're having, but you've stripped away too much context. What are lazyMap and f? At least, what are their types? On 18 Apr 2016 22:03, "David Feuer" wrote: > Consider the implementation of `second` for pairs: > > second f ~(a,b) = (a, f b) > > Now > > fix $ second (3 :) > > Will be (undefined, [3,3,....]) > > Translating this to IO, I'd want > > lazyMap f undefined > > to produce as much as possible of the result, although it cannot produce > the final State# RealWorld token. > On Apr 18, 2016 4:47 PM, "David Turner" > wrote: > >> You can't know that the final result of the computation (x `seq` (3:...)) >> will begin with 3, because sometimes it doesn't! More specifically, it >> diverges (without yielding the 3) if x diverges. >> >> I don't think this is anything special about mfix: (let x = x `seq` 3:... >> in x) also diverges for the same reason. >> >> Hope that helps, >> >> David >> On 18 Apr 2016 21:19, "David Feuer" wrote: >> >>> If >>> >>> f :: a -> IO a >>> >>> for some a, and I want to use >>> >>> mfix f >>> >>> then f must not inspect its argument in any way, or the computation >>> will get stuck. In some cases, this seems a bit harsh. For example, >>> >>> mfix (\x -> fmap (3 :) (x `seq` readLn)) >>> >>> looks perfectly reasonable. There is no need to inspect the return [] >>> action to know that the final result of the computation will begin >>> with 3:. Is there a lazy IO mapping function somewhere that can work >>> such magic? >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar1976 at gmail.com Mon Apr 18 21:42:51 2016 From: davidescobar1976 at gmail.com (David Escobar) Date: Mon, 18 Apr 2016 14:42:51 -0700 Subject: [Haskell-cafe] Sending email Message-ID: Hi everyone, I'm trying to use the *Network.Mail.SMTP* library to send email: *{-# LANGUAGE OverloadedStrings #-}* *module Main where* *import Control.Exception* *import qualified Data.Text as T* *import qualified Data.Text.Lazy as LT* *import Network.Mail.SMTP* *main :: IO ()* *main = do* * sendEmail (?Person sender?, ?sender at somewhere.com ?)* * [(?Person recipient?, ?recipient at somewhere.com ?)]* * "Test email"* * "Some message goes here."* *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text -> IO ()* *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) toEmail) toAddresses* * msg = simpleMail (Address (Just fromName) fromEmail)* * toNameAddrs* * []* * []* * subject'* * [ plainTextPart $ LT.fromStrict body' ]* * result <- try $ sendMailWithLogin' "smtp.gmail.com "* * 465 -- SSL port* * ?sender_login?* * ?sender_password?* * msg :: IO (Either SomeException ())* * case result of* * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* * Right _ -> putStrLn "Sent email successfully."* The program compiles, but when I run it, I get: *Exception caught: : Data.ByteString.hGetLine: end of file* I tried using the TLS port of 587, but then I just get an authentication failure. Am I using the wrong library or is it just the wrong configuration. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar1976 at gmail.com Mon Apr 18 22:36:03 2016 From: davidescobar1976 at gmail.com (David Escobar) Date: Mon, 18 Apr 2016 15:36:03 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: No explicit mention is made anywhere in the documentation about TLS or even SSL, so perhaps not? Some libraries I've come across specifically mention that they don't support TLS or SSL. Being relatively new to this part of Haskell, what is the most standard library the community uses for email that supports modern protocols such as those used by GMail? Thanks. On Mon, Apr 18, 2016 at 2:49 PM, Alex Feldman-Crough wrote: > Does the library support TLS? Does it have to be configured differently? > It sounds like a negotiation error to me. > On Mon, Apr 18, 2016 at 2:43 PM David Escobar > wrote: > >> Hi everyone, >> I'm trying to use the *Network.Mail.SMTP* library to send email: >> >> *{-# LANGUAGE OverloadedStrings #-}* >> >> *module Main where* >> >> *import Control.Exception* >> >> *import qualified Data.Text as T* >> *import qualified Data.Text.Lazy as LT* >> *import Network.Mail.SMTP* >> >> *main :: IO ()* >> *main = do* >> * sendEmail (?Person sender?, ?sender at somewhere.com >> ?)* >> * [(?Person recipient?, ?recipient at somewhere.com >> ?)]* >> * "Test email"* >> * "Some message goes here."* >> >> >> *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text >> -> IO ()* >> *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* >> * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) >> toEmail) toAddresses* >> * msg = simpleMail (Address (Just fromName) fromEmail)* >> * toNameAddrs* >> * []* >> * []* >> * subject'* >> * [ plainTextPart $ LT.fromStrict body' ]* >> * result <- try $ sendMailWithLogin' "smtp.gmail.com >> "* >> * 465 -- SSL port* >> * ?sender_login?* >> * ?sender_password?* >> * msg :: IO (Either SomeException ())* >> * case result of* >> * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* >> * Right _ -> putStrLn "Sent email successfully."* >> >> >> The program compiles, but when I run it, I get: >> >> *Exception caught: : Data.ByteString.hGetLine: end of file* >> >> I tried using the TLS port of 587, but then I just get an authentication >> failure. Am I using the wrong library or is it just the wrong >> configuration. Thanks. >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > -- > Alex Feldman Crough > 602 573-9588 -------------- next part -------------- An HTML attachment was scrubbed... URL: From aovieth at gmail.com Mon Apr 18 22:43:43 2016 From: aovieth at gmail.com (Alexander Vieth) Date: Mon, 18 Apr 2016 18:43:43 -0400 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Right, you need to STARTTLS and upgrade to a secure connection before trying to authenticate, but smtp-mail will not take care of this for you. You could do it manually, using the tls package, or you could try smtp-mail-ng[1][2]. Alex [1] https://github.com/avieth/smtp-mail-ng [2] https://hackage.haskell.org/package/smtp-mail-ng-0.1.0.1 On Mon, Apr 18, 2016 at 6:36 PM, David Escobar wrote: > No explicit mention is made anywhere in the documentation about TLS or > even SSL, so perhaps not? Some libraries I've come across specifically > mention that they don't support TLS or SSL. Being relatively new to this > part of Haskell, what is the most standard library the community uses for > email that supports modern protocols such as those used by GMail? Thanks. > > On Mon, Apr 18, 2016 at 2:49 PM, Alex Feldman-Crough > wrote: > >> Does the library support TLS? Does it have to be configured differently? >> It sounds like a negotiation error to me. >> On Mon, Apr 18, 2016 at 2:43 PM David Escobar >> wrote: >> >>> Hi everyone, >>> I'm trying to use the *Network.Mail.SMTP* library to send email: >>> >>> *{-# LANGUAGE OverloadedStrings #-}* >>> >>> *module Main where* >>> >>> *import Control.Exception* >>> >>> *import qualified Data.Text as T* >>> *import qualified Data.Text.Lazy as LT* >>> *import Network.Mail.SMTP* >>> >>> *main :: IO ()* >>> *main = do* >>> * sendEmail (?Person sender?, ?sender at somewhere.com >>> ?)* >>> * [(?Person recipient?, ?recipient at somewhere.com >>> ?)]* >>> * "Test email"* >>> * "Some message goes here."* >>> >>> >>> *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text >>> -> IO ()* >>> *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* >>> * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) >>> toEmail) toAddresses* >>> * msg = simpleMail (Address (Just fromName) fromEmail)* >>> * toNameAddrs* >>> * []* >>> * []* >>> * subject'* >>> * [ plainTextPart $ LT.fromStrict body' ]* >>> * result <- try $ sendMailWithLogin' "smtp.gmail.com >>> "* >>> * 465 -- SSL port* >>> * ?sender_login?* >>> * ?sender_password?* >>> * msg :: IO (Either SomeException >>> ())* >>> * case result of* >>> * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* >>> * Right _ -> putStrLn "Sent email successfully."* >>> >>> >>> The program compiles, but when I run it, I get: >>> >>> *Exception caught: : Data.ByteString.hGetLine: end of file* >>> >>> I tried using the TLS port of 587, but then I just get an authentication >>> failure. Am I using the wrong library or is it just the wrong >>> configuration. Thanks. >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> -- >> Alex Feldman Crough >> 602 573-9588 > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From donn at avvanta.com Mon Apr 18 23:23:49 2016 From: donn at avvanta.com (Donn Cave) Date: Mon, 18 Apr 2016 16:23:49 -0700 (PDT) Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: <20160418232349.2AF75F393A@mail.avvanta.com> quoth David Escobar > No explicit mention is made anywhere in the documentation about TLS or even > SSL, so perhaps not? Some libraries I've come across specifically mention > that they don't support TLS or SSL. Being relatively new to this part of > Haskell, what is the most standard library the community uses for email > that supports modern protocols such as those used by GMail? Thanks. I'm not going to guess what the community is up to, but it seems to me like the least novel way to get there would be an SSL connection to port 465, using HsOpenSSL, and use the library you were already using for SMTP. I do that, essentially, though with home rolled stuff for various not very interesting reasons. So I haven't tried these two packages, but I can assure you that the principle works with gmail. If your SMTP package won't accept some kind of generic I/O channel and insists on making and using its own socket connection, then you'll need something else. Ideally, it would provide pure functions for SMTP parsing and protocol interpretation, and you could do the I/O stuff yourself via whatever channel you wish, but that pure/io structural division seems surprisingly rare among Haskell network application packages. Donn From david.feuer at gmail.com Mon Apr 18 23:25:30 2016 From: david.feuer at gmail.com (David Feuer) Date: Mon, 18 Apr 2016 19:25:30 -0400 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? In-Reply-To: References: Message-ID: lazyMap :: (a -> b) -> IO a -> IO b, hypothetically. Let me take a step back. There are two ways I know of to use the result of an IO action. The most common way, by far, is to use >>= to send it on to the next computation. The other notable way is to use fixIO. No part of the result of an IO action becomes available until that action "completes" (in the shady case of lazy IO, this may be immediate, but I'm ignoring lazy IO for this discussion). This causes the well-known inefficiency of mapM in IO: individual results cannot be consed until the entire computation is complete. It seems to cause much more painful effects for fixIO--lazy programming techniques may simply be unavailable. For example, it's possible for a pure computation using a queue in a single-threaded fashion to represent that queue as a list, tying the knot to pass the list of all enqueued elements to the beginning. If an IO computation wants to use a queue, this technique does not seem to be available. The knot can be tied with fixIO, but conses are delayed until it's too late--attempting to dequeue an element will block forever. I'm wondering if there's some way to make this sort of thing work, either with plain Haskell IO or some thin layer built on top. On Apr 18, 2016 5:12 PM, "David Turner" wrote: > Sorry, you've lost me. I suspect you're trying to give a minimal example > of the problem you're having, but you've stripped away too much context. > What are lazyMap and f? At least, what are their types? > On 18 Apr 2016 22:03, "David Feuer" wrote: > >> Consider the implementation of `second` for pairs: >> >> second f ~(a,b) = (a, f b) >> >> Now >> >> fix $ second (3 :) >> >> Will be (undefined, [3,3,....]) >> >> Translating this to IO, I'd want >> >> lazyMap f undefined >> >> to produce as much as possible of the result, although it cannot produce >> the final State# RealWorld token. >> On Apr 18, 2016 4:47 PM, "David Turner" >> wrote: >> >>> You can't know that the final result of the computation (x `seq` >>> (3:...)) will begin with 3, because sometimes it doesn't! More >>> specifically, it diverges (without yielding the 3) if x diverges. >>> >>> I don't think this is anything special about mfix: (let x = x `seq` >>> 3:... in x) also diverges for the same reason. >>> >>> Hope that helps, >>> >>> David >>> On 18 Apr 2016 21:19, "David Feuer" wrote: >>> >>>> If >>>> >>>> f :: a -> IO a >>>> >>>> for some a, and I want to use >>>> >>>> mfix f >>>> >>>> then f must not inspect its argument in any way, or the computation >>>> will get stuck. In some cases, this seems a bit harsh. For example, >>>> >>>> mfix (\x -> fmap (3 :) (x `seq` readLn)) >>>> >>>> looks perfectly reasonable. There is no need to inspect the return [] >>>> action to know that the final result of the computation will begin >>>> with 3:. Is there a lazy IO mapping function somewhere that can work >>>> such magic? >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Mon Apr 18 23:45:16 2016 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Tue, 19 Apr 2016 05:15:16 +0530 Subject: [Haskell-cafe] Existential quantification of config data types In-Reply-To: References: Message-ID: You can create a readLayer function that returns something like this: * data** OneLayer** =** forall** a. Layer a =>** OneLayer** a* Such that we get: * -- Read next layer* *readLayer** :: Handle -> IO* *OneLayer* Still, I feel that an ADT that combines all types is better as it fits the problem perfectly. Every time you add a new layer it will generate warnings for missing pattern matches. Regards, Sumit -------------- next part -------------- An HTML attachment was scrubbed... URL: From cpdurham at gmail.com Tue Apr 19 00:10:33 2016 From: cpdurham at gmail.com (Charlie Durham) Date: Mon, 18 Apr 2016 20:10:33 -0400 Subject: [Haskell-cafe] Existential quantification of config data types In-Reply-To: References: Message-ID: Yeah, I'm starting to think the ADT makes the most sense. With the readLayer call though, how do you know which layer to read? Or are you still stuck with the failing to parse a list of potentials and then taking the one that doesnt fail? Thanks, Charlie On Mon, Apr 18, 2016 at 7:45 PM, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote: > You can create a readLayer function that returns something like this: > > * data** OneLayer** =** forall** a. Layer a =>** OneLayer** a* > > Such that we get: > > * -- Read next layer* > *readLayer** :: Handle -> IO* *OneLayer* > > Still, I feel that an ADT that combines all types is better as it fits the > problem perfectly. Every time you add a new layer it will generate warnings > for missing pattern matches. > > Regards, > Sumit > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar1976 at gmail.com Tue Apr 19 01:15:26 2016 From: davidescobar1976 at gmail.com (David Escobar) Date: Mon, 18 Apr 2016 18:15:26 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Thanks Alex. I'll start looking into that. On Mon, Apr 18, 2016 at 3:43 PM, Alexander Vieth wrote: > Right, you need to STARTTLS and upgrade to a secure connection before > trying to authenticate, but smtp-mail will not take care of this for you. > You could do it manually, using the tls package, or you could try > smtp-mail-ng[1][2]. > > Alex > > [1] https://github.com/avieth/smtp-mail-ng > [2] https://hackage.haskell.org/package/smtp-mail-ng-0.1.0.1 > > On Mon, Apr 18, 2016 at 6:36 PM, David Escobar > wrote: > >> No explicit mention is made anywhere in the documentation about TLS or >> even SSL, so perhaps not? Some libraries I've come across specifically >> mention that they don't support TLS or SSL. Being relatively new to this >> part of Haskell, what is the most standard library the community uses for >> email that supports modern protocols such as those used by GMail? Thanks. >> >> On Mon, Apr 18, 2016 at 2:49 PM, Alex Feldman-Crough >> wrote: >> >>> Does the library support TLS? Does it have to be configured differently? >>> It sounds like a negotiation error to me. >>> On Mon, Apr 18, 2016 at 2:43 PM David Escobar < >>> davidescobar1976 at gmail.com> wrote: >>> >>>> Hi everyone, >>>> I'm trying to use the *Network.Mail.SMTP* library to send email: >>>> >>>> *{-# LANGUAGE OverloadedStrings #-}* >>>> >>>> *module Main where* >>>> >>>> *import Control.Exception* >>>> >>>> *import qualified Data.Text as T* >>>> *import qualified Data.Text.Lazy as LT* >>>> *import Network.Mail.SMTP* >>>> >>>> *main :: IO ()* >>>> *main = do* >>>> * sendEmail (?Person sender?, ?sender at somewhere.com >>>> ?)* >>>> * [(?Person recipient?, ?recipient at somewhere.com >>>> ?)]* >>>> * "Test email"* >>>> * "Some message goes here."* >>>> >>>> >>>> *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> >>>> T.Text -> IO ()* >>>> *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* >>>> * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) >>>> toEmail) toAddresses* >>>> * msg = simpleMail (Address (Just fromName) fromEmail)* >>>> * toNameAddrs* >>>> * []* >>>> * []* >>>> * subject'* >>>> * [ plainTextPart $ LT.fromStrict body' ]* >>>> * result <- try $ sendMailWithLogin' "smtp.gmail.com >>>> "* >>>> * 465 -- SSL port* >>>> * ?sender_login?* >>>> * ?sender_password?* >>>> * msg :: IO (Either SomeException >>>> ())* >>>> * case result of* >>>> * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* >>>> * Right _ -> putStrLn "Sent email successfully."* >>>> >>>> >>>> The program compiles, but when I run it, I get: >>>> >>>> *Exception caught: : Data.ByteString.hGetLine: end of file* >>>> >>>> I tried using the TLS port of 587, but then I just get an >>>> authentication failure. Am I using the wrong library or is it just the >>>> wrong configuration. Thanks. >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>> -- >>> Alex Feldman Crough >>> 602 573-9588 >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Tue Apr 19 01:16:27 2016 From: davidescobar at ieee.org (David Escobar) Date: Mon, 18 Apr 2016 18:16:27 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: <20160418232349.2AF75F393A@mail.avvanta.com> References: <20160418232349.2AF75F393A@mail.avvanta.com> Message-ID: Thanks, that makes sense. Out of curiosity, which one do you use with HsOpenSSL? On Mon, Apr 18, 2016 at 4:23 PM, Donn Cave wrote: > quoth David Escobar > > > No explicit mention is made anywhere in the documentation about TLS or > even > > SSL, so perhaps not? Some libraries I've come across specifically mention > > that they don't support TLS or SSL. Being relatively new to this part of > > Haskell, what is the most standard library the community uses for email > > that supports modern protocols such as those used by GMail? Thanks. > > I'm not going to guess what the community is up to, but it seems > to me like the least novel way to get there would be an SSL connection > to port 465, using HsOpenSSL, and use the library you were already using > for SMTP. > > I do that, essentially, though with home rolled stuff for various > not very interesting reasons. So I haven't tried these two packages, > but I can assure you that the principle works with gmail. > > If your SMTP package won't accept some kind of generic I/O channel > and insists on making and using its own socket connection, then > you'll need something else. Ideally, it would provide pure functions > for SMTP parsing and protocol interpretation, and you could do the > I/O stuff yourself via whatever channel you wish, but that pure/io > structural division seems surprisingly rare among Haskell network > application packages. > > Donn > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Tue Apr 19 01:18:04 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Mon, 18 Apr 2016 18:18:04 -0700 Subject: [Haskell-cafe] diffs on HaskellWiki Message-ID: <5715874C.2040508@funwithsoftware.org> I've noticed that when viewing changes on HaskellWiki, the diffs are missing. We had a similar problem on the OpenSSL wiki (which, like HaskellWiki, is based on MediaWiki), and the sysadmin said he fixed the problem by switching from the external diff engine to the internal diff engine. Is there someone who could look into this and possibly make that change to the wiki's configuration? I looked around the HaskellWiki and couldn't find any mention of how to contact a maintainer. Thanks, --Patrick From donn at avvanta.com Tue Apr 19 01:53:59 2016 From: donn at avvanta.com (Donn Cave) Date: Mon, 18 Apr 2016 18:53:59 -0700 (PDT) Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: <20160419015359.26DFBF3935@mail.avvanta.com> quoth David Escobar > Thanks, that makes sense. Out of curiosity, which one do you use with > HsOpenSSL? [... where I said ...] >> I do that, essentially, though with home rolled stuff for various >> not very interesting reasons. So I haven't tried these two packages, "Home rolled" means I wrote my own SMTP protocol software, and my own OpenSSL wrapper. I haven't tried HsOpenSSL and don't know anything about it - want to be clear about that! Donn From davidescobar1976 at gmail.com Tue Apr 19 05:47:16 2016 From: davidescobar1976 at gmail.com (David Escobar) Date: Mon, 18 Apr 2016 22:47:16 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Alex, unfortunately I get compiler errors when adding the *smtp-mail-ng* library (I'm using Stack for my dependency management/builds). Not sure if I'm doing something wrong on my end, but it seems to be something in the library itself. * /private/var/folders/kg/p_frph3n0d71yfmvn553s4rh0000gn/T/stack69375/smtp-mail-ng-0.1.0.2/Network/Mail/SMTP/SMTP.hs:201:3:* * Couldn't match type ?Context? with ?IO Context?* * Expected type: SystemRNG -> IO Context* * Actual type: SystemRNG -> Context* * The function ?contextNew? is applied to three arguments,* * its type is ?backend0 -> params0 -> m0 Context?,* * it is specialized to ?Handle* * -> ClientParams -> SystemRNG -> Context?* * In a stmt of a 'do' block: contextNew handle params rng* * In the expression:* * do { rng <- (createEntropyPool >>= return . cprgCreate) ::* * IO SystemRNG;* * certStore <- getSystemCertificateStore;* * let params = tlsClientParams hostname certStore;* * contextNew handle params rng }* On Mon, Apr 18, 2016 at 6:15 PM, David Escobar wrote: > Thanks Alex. I'll start looking into that. > > > On Mon, Apr 18, 2016 at 3:43 PM, Alexander Vieth > wrote: > >> Right, you need to STARTTLS and upgrade to a secure connection before >> trying to authenticate, but smtp-mail will not take care of this for you. >> You could do it manually, using the tls package, or you could try >> smtp-mail-ng[1][2]. >> >> Alex >> >> [1] https://github.com/avieth/smtp-mail-ng >> [2] https://hackage.haskell.org/package/smtp-mail-ng-0.1.0.1 >> >> On Mon, Apr 18, 2016 at 6:36 PM, David Escobar < >> davidescobar1976 at gmail.com> wrote: >> >>> No explicit mention is made anywhere in the documentation about TLS or >>> even SSL, so perhaps not? Some libraries I've come across specifically >>> mention that they don't support TLS or SSL. Being relatively new to this >>> part of Haskell, what is the most standard library the community uses for >>> email that supports modern protocols such as those used by GMail? Thanks. >>> >>> On Mon, Apr 18, 2016 at 2:49 PM, Alex Feldman-Crough >>> wrote: >>> >>>> Does the library support TLS? Does it have to be configured >>>> differently? It sounds like a negotiation error to me. >>>> On Mon, Apr 18, 2016 at 2:43 PM David Escobar < >>>> davidescobar1976 at gmail.com> wrote: >>>> >>>>> Hi everyone, >>>>> I'm trying to use the *Network.Mail.SMTP* library to send email: >>>>> >>>>> *{-# LANGUAGE OverloadedStrings #-}* >>>>> >>>>> *module Main where* >>>>> >>>>> *import Control.Exception* >>>>> >>>>> *import qualified Data.Text as T* >>>>> *import qualified Data.Text.Lazy as LT* >>>>> *import Network.Mail.SMTP* >>>>> >>>>> *main :: IO ()* >>>>> *main = do* >>>>> * sendEmail (?Person sender?, ?sender at somewhere.com >>>>> ?)* >>>>> * [(?Person recipient?, ?recipient at somewhere.com >>>>> ?)]* >>>>> * "Test email"* >>>>> * "Some message goes here."* >>>>> >>>>> >>>>> *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> >>>>> T.Text -> IO ()* >>>>> *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* >>>>> * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) >>>>> toEmail) toAddresses* >>>>> * msg = simpleMail (Address (Just fromName) fromEmail)* >>>>> * toNameAddrs* >>>>> * []* >>>>> * []* >>>>> * subject'* >>>>> * [ plainTextPart $ LT.fromStrict body' ]* >>>>> * result <- try $ sendMailWithLogin' "smtp.gmail.com >>>>> "* >>>>> * 465 -- SSL port* >>>>> * ?sender_login?* >>>>> * ?sender_password?* >>>>> * msg :: IO (Either SomeException >>>>> ())* >>>>> * case result of* >>>>> * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* >>>>> * Right _ -> putStrLn "Sent email successfully."* >>>>> >>>>> >>>>> The program compiles, but when I run it, I get: >>>>> >>>>> *Exception caught: : Data.ByteString.hGetLine: end of file* >>>>> >>>>> I tried using the TLS port of 587, but then I just get an >>>>> authentication failure. Am I using the wrong library or is it just the >>>>> wrong configuration. Thanks. >>>>> _______________________________________________ >>>>> Haskell-Cafe mailing list >>>>> Haskell-Cafe at haskell.org >>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>> >>>> -- >>>> Alex Feldman Crough >>>> 602 573-9588 >>> >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Tue Apr 19 05:48:59 2016 From: davidescobar at ieee.org (David Escobar) Date: Mon, 18 Apr 2016 22:48:59 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: <20160419015359.26DFBF3935@mail.avvanta.com> References: <20160419015359.26DFBF3935@mail.avvanta.com> Message-ID: Oh ok, my misunderstanding. I didn't realized you had done all that! On Mon, Apr 18, 2016 at 6:53 PM, Donn Cave wrote: > quoth David Escobar > > > Thanks, that makes sense. Out of curiosity, which one do you use with > > HsOpenSSL? > > [... where I said ...] > >> I do that, essentially, though with home rolled stuff for various > >> not very interesting reasons. So I haven't tried these two packages, > > "Home rolled" means I wrote my own SMTP protocol software, and my own > OpenSSL wrapper. I haven't tried HsOpenSSL and don't know anything about > it - > want to be clear about that! > > Donn > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dani at dpwright.com Tue Apr 19 05:59:28 2016 From: dani at dpwright.com (Daniel P. Wright) Date: Tue, 19 Apr 2016 14:59:28 +0900 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Not to throw another spanner in the works with Yet Another Package to try, but another option is HaskellNet[1] with HaskellNet-SSL[2] for your TLS connection. I originally wrote the HaskellNet-SSL wrapper but it's currently being maintained by Leza Morais Lutonda. It works with gmail. I haven't tried any of the other SMTP options and I mostly used it for IMAP, not SMTP, so I can't compare them directly or recommend one over the other -- just throwing it out there as another option! [1]: http://hackage.haskell.org/package/HaskellNet [2]: http://hackage.haskell.org/package/HaskellNet-SSL 2016-04-19 6:42 GMT+09:00 David Escobar : > Hi everyone, > I'm trying to use the *Network.Mail.SMTP* library to send email: > > *{-# LANGUAGE OverloadedStrings #-}* > > *module Main where* > > *import Control.Exception* > > *import qualified Data.Text as T* > *import qualified Data.Text.Lazy as LT* > *import Network.Mail.SMTP* > > *main :: IO ()* > *main = do* > * sendEmail (?Person sender?, ?sender at somewhere.com > ?)* > * [(?Person recipient?, ?recipient at somewhere.com > ?)]* > * "Test email"* > * "Some message goes here."* > > > *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text > -> IO ()* > *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* > * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) > toEmail) toAddresses* > * msg = simpleMail (Address (Just fromName) fromEmail)* > * toNameAddrs* > * []* > * []* > * subject'* > * [ plainTextPart $ LT.fromStrict body' ]* > * result <- try $ sendMailWithLogin' "smtp.gmail.com > "* > * 465 -- SSL port* > * ?sender_login?* > * ?sender_password?* > * msg :: IO (Either SomeException ())* > * case result of* > * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* > * Right _ -> putStrLn "Sent email successfully."* > > > The program compiles, but when I run it, I get: > > *Exception caught: : Data.ByteString.hGetLine: end of file* > > I tried using the TLS port of 587, but then I just get an authentication > failure. Am I using the wrong library or is it just the wrong > configuration. Thanks. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Tue Apr 19 06:30:14 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 19 Apr 2016 07:30:14 +0100 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? In-Reply-To: References: Message-ID: I suspect you're looking for something like lazy IO (or a similarly unsafe cousin like unsafeInterleaveIO as featured in the definition of fixIO) although I still remain a bit confused. The type of lazyMap :: (a -> b) -> IO a -> IO b is the same as for fmap, but fmap is already as lazy as it can be without unsafeness: fmap (const ()) (return undefined) = return () fmap (const ()) undefined = undefined You can't (safely) define lazyMap where lazyMap f ma doesn't have all the real-world effects of ma before returning. If ma has infinitely many effects then it's not going to return, because if it did then you'd have your hands on something of pure type 'b' which continues to have real-world effects as you evaluate it. This is, roughly speaking, lazy IO. On the other hand, you mention knot-tying and this is precisely what fixIO is for. A slightly contrived example: import Control.Monad import Control.Monad.Fix main :: IO () main = do fibs <- fibsIO print $ fibs !! 10 fibsIO :: IO [Int] fibsIO = mfix $ \fibs -> do fibs' <- forM [2..10] $ \i -> do putStrLn $ "Calculating fibs !! " ++ show i return $ fibs !! (i-1) + fibs !! (i-2) return $ 0:1:fibs' Note that I have to limit the number of actions for this to work - if it said 'forM [2..] then there'd be infinitely many effects and it'd never return. Hope that helps, David On 19 April 2016 at 00:25, David Feuer wrote: > lazyMap :: (a -> b) -> IO a -> IO b, hypothetically. > > Let me take a step back. There are two ways I know of to use the result of > an IO action. The most common way, by far, is to use >>= to send it on to > the next computation. The other notable way is to use fixIO. > > No part of the result of an IO action becomes available until that action > "completes" (in the shady case of lazy IO, this may be immediate, but I'm > ignoring lazy IO for this discussion). This causes the well-known > inefficiency of mapM in IO: individual results cannot be consed until the > entire computation is complete. It seems to cause much more painful effects > for fixIO--lazy programming techniques may simply be unavailable. > > For example, it's possible for a pure computation using a queue in a > single-threaded fashion to represent that queue as a list, tying the knot > to pass the list of all enqueued elements to the beginning. If an IO > computation wants to use a queue, this technique does not seem to be > available. The knot can be tied with fixIO, but conses are delayed until > it's too late--attempting to dequeue an element will block forever. > > I'm wondering if there's some way to make this sort of thing work, either > with plain Haskell IO or some thin layer built on top. > On Apr 18, 2016 5:12 PM, "David Turner" > wrote: > >> Sorry, you've lost me. I suspect you're trying to give a minimal example >> of the problem you're having, but you've stripped away too much context. >> What are lazyMap and f? At least, what are their types? >> On 18 Apr 2016 22:03, "David Feuer" wrote: >> >>> Consider the implementation of `second` for pairs: >>> >>> second f ~(a,b) = (a, f b) >>> >>> Now >>> >>> fix $ second (3 :) >>> >>> Will be (undefined, [3,3,....]) >>> >>> Translating this to IO, I'd want >>> >>> lazyMap f undefined >>> >>> to produce as much as possible of the result, although it cannot produce >>> the final State# RealWorld token. >>> On Apr 18, 2016 4:47 PM, "David Turner" >>> wrote: >>> >>>> You can't know that the final result of the computation (x `seq` >>>> (3:...)) will begin with 3, because sometimes it doesn't! More >>>> specifically, it diverges (without yielding the 3) if x diverges. >>>> >>>> I don't think this is anything special about mfix: (let x = x `seq` >>>> 3:... in x) also diverges for the same reason. >>>> >>>> Hope that helps, >>>> >>>> David >>>> On 18 Apr 2016 21:19, "David Feuer" wrote: >>>> >>>>> If >>>>> >>>>> f :: a -> IO a >>>>> >>>>> for some a, and I want to use >>>>> >>>>> mfix f >>>>> >>>>> then f must not inspect its argument in any way, or the computation >>>>> will get stuck. In some cases, this seems a bit harsh. For example, >>>>> >>>>> mfix (\x -> fmap (3 :) (x `seq` readLn)) >>>>> >>>>> looks perfectly reasonable. There is no need to inspect the return [] >>>>> action to know that the final result of the computation will begin >>>>> with 3:. Is there a lazy IO mapping function somewhere that can work >>>>> such magic? >>>>> _______________________________________________ >>>>> Haskell-Cafe mailing list >>>>> Haskell-Cafe at haskell.org >>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>>> >>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar1976 at gmail.com Tue Apr 19 08:13:46 2016 From: davidescobar1976 at gmail.com (David Escobar) Date: Tue, 19 Apr 2016 01:13:46 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Actually Daniel, I'm glad you mentioned it. *HaskellNet* and *HaskellNet-SSL* actually worked for me! Thank you for that! The only thing I noticed with Gmail is that in order to work it requires the sender's account to toggle this setting: Allow less secure apps: OFF Doesn't seem ideal, but I'm not sure if that's a fault of the library itself or just the way it is with generic 3rd party apps that aren't somehow registered with Google. But in any case, when I try it with another Amazon AWS account, it doesn't have that problem, so it's all good since that's the real account I wanted to get it working with anyway (Gmail was just a more convenient "testing" platform). In any case, here is the short generic code that works for future reference so that hopefully others don't have to go through the same process just to send an email. Thanks again Daniel, and thanks to everyone else for their answers as well! P.S. the *sslLogToConsole* option is great for seeing the handshaking going on with the SMTP server. *main :: IO ()* *main = doSMTPSTARTTLSWithSettings "smtp.gmail.com " settings $ \conn -> do* * authSucceed <- authenticate LOGIN "gmail_login" "gmail_password" conn* * if authSucceed* * then do* * putStrLn "Sending email..."* * sendPlainTextMail "recipient at somewhere.com "* * "sender at somewhere_else.com "* * "Haskell Email"* * "I can finally send email from Haskell now!!"* * conn* * else print "Authentication failed."* * where settings = defaultSettingsSMTPSTARTTLS { sslPort = 587, sslLogToConsole = True }* On Mon, Apr 18, 2016 at 10:59 PM, Daniel P. Wright wrote: > Not to throw another spanner in the works with Yet Another Package to try, > but another option is HaskellNet[1] with HaskellNet-SSL[2] for your TLS > connection. I originally wrote the HaskellNet-SSL wrapper but it's > currently being maintained by Leza Morais Lutonda. It works with gmail. I > haven't tried any of the other SMTP options and I mostly used it for IMAP, > not SMTP, so I can't compare them directly or recommend one over the other > -- just throwing it out there as another option! > > [1]: http://hackage.haskell.org/package/HaskellNet > [2]: http://hackage.haskell.org/package/HaskellNet-SSL > > 2016-04-19 6:42 GMT+09:00 David Escobar : > >> Hi everyone, >> I'm trying to use the *Network.Mail.SMTP* library to send email: >> >> *{-# LANGUAGE OverloadedStrings #-}* >> >> *module Main where* >> >> *import Control.Exception* >> >> *import qualified Data.Text as T* >> *import qualified Data.Text.Lazy as LT* >> *import Network.Mail.SMTP* >> >> *main :: IO ()* >> *main = do* >> * sendEmail (?Person sender?, ?sender at somewhere.com >> ?)* >> * [(?Person recipient?, ?recipient at somewhere.com >> ?)]* >> * "Test email"* >> * "Some message goes here."* >> >> >> *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text >> -> IO ()* >> *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* >> * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) >> toEmail) toAddresses* >> * msg = simpleMail (Address (Just fromName) fromEmail)* >> * toNameAddrs* >> * []* >> * []* >> * subject'* >> * [ plainTextPart $ LT.fromStrict body' ]* >> * result <- try $ sendMailWithLogin' "smtp.gmail.com >> "* >> * 465 -- SSL port* >> * ?sender_login?* >> * ?sender_password?* >> * msg :: IO (Either SomeException ())* >> * case result of* >> * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* >> * Right _ -> putStrLn "Sent email successfully."* >> >> >> The program compiles, but when I run it, I get: >> >> *Exception caught: : Data.ByteString.hGetLine: end of file* >> >> I tried using the TLS port of 587, but then I just get an authentication >> failure. Am I using the wrong library or is it just the wrong >> configuration. Thanks. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar1976 at gmail.com Tue Apr 19 08:19:52 2016 From: davidescobar1976 at gmail.com (David Escobar) Date: Tue, 19 Apr 2016 01:19:52 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Forgot to include the header and imported modules in my last message: *{-# LANGUAGE OverloadedStrings #-}* *module Main where* *import Network.HaskellNet.SMTP* *import Network.HaskellNet.SMTP.SSL* *main :: IO ()* *main = doSMTPSTARTTLSWithSettings "smtp.gmail.com " settings $ \conn -> do* * authSucceed <- authenticate LOGIN "gmail_login" "gmail_password" conn* * if authSucceed* * then do* * putStrLn "Sending email..."* * sendPlainTextMail "recipient at somewhere.com "* * "sender at somewhere_else.com "* * "Haskell Email"* * "I can finally send email from Haskell now!!"* * conn* * else print "Authentication failed."* * where settings = defaultSettingsSMTPSTARTTLS { sslPort = 587, sslLogToConsole = True }* On Tue, Apr 19, 2016 at 1:13 AM, David Escobar wrote: > Actually Daniel, I'm glad you mentioned it. *HaskellNet* and > *HaskellNet-SSL* actually worked for me! Thank you for that! > > The only thing I noticed with Gmail is that in order to work it requires > the sender's account to toggle this setting: > Allow less secure apps: OFF > > Doesn't seem ideal, but I'm not sure if that's a fault of the library > itself or just the way it is with generic 3rd party apps that aren't > somehow registered with Google. But in any case, when I try it with another > Amazon AWS account, it doesn't have that problem, so it's all good since > that's the real account I wanted to get it working with anyway (Gmail was > just a more convenient "testing" platform). > > In any case, here is the short generic code that works for future > reference so that hopefully others don't have to go through the same > process just to send an email. Thanks again Daniel, and thanks to everyone > else for their answers as well! > > P.S. the *sslLogToConsole* option is great for seeing the handshaking > going on with the SMTP server. > > *main :: IO ()* > *main = doSMTPSTARTTLSWithSettings "smtp.gmail.com > " settings $ \conn -> do* > * authSucceed <- authenticate LOGIN "gmail_login" "gmail_password" conn* > * if authSucceed* > * then do* > * putStrLn "Sending email..."* > * sendPlainTextMail "recipient at somewhere.com > "* > * "sender at somewhere_else.com > "* > * "Haskell Email"* > * "I can finally send email from > Haskell now!!"* > * conn* > * else print "Authentication failed."* > * where settings = defaultSettingsSMTPSTARTTLS { sslPort = 587, > sslLogToConsole = True }* > > > On Mon, Apr 18, 2016 at 10:59 PM, Daniel P. Wright > wrote: > >> Not to throw another spanner in the works with Yet Another Package to >> try, but another option is HaskellNet[1] with HaskellNet-SSL[2] for your >> TLS connection. I originally wrote the HaskellNet-SSL wrapper but it's >> currently being maintained by Leza Morais Lutonda. It works with gmail. I >> haven't tried any of the other SMTP options and I mostly used it for IMAP, >> not SMTP, so I can't compare them directly or recommend one over the other >> -- just throwing it out there as another option! >> >> [1]: http://hackage.haskell.org/package/HaskellNet >> [2]: http://hackage.haskell.org/package/HaskellNet-SSL >> >> 2016-04-19 6:42 GMT+09:00 David Escobar : >> >>> Hi everyone, >>> I'm trying to use the *Network.Mail.SMTP* library to send email: >>> >>> *{-# LANGUAGE OverloadedStrings #-}* >>> >>> *module Main where* >>> >>> *import Control.Exception* >>> >>> *import qualified Data.Text as T* >>> *import qualified Data.Text.Lazy as LT* >>> *import Network.Mail.SMTP* >>> >>> *main :: IO ()* >>> *main = do* >>> * sendEmail (?Person sender?, ?sender at somewhere.com >>> ?)* >>> * [(?Person recipient?, ?recipient at somewhere.com >>> ?)]* >>> * "Test email"* >>> * "Some message goes here."* >>> >>> >>> *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text >>> -> IO ()* >>> *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* >>> * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) >>> toEmail) toAddresses* >>> * msg = simpleMail (Address (Just fromName) fromEmail)* >>> * toNameAddrs* >>> * []* >>> * []* >>> * subject'* >>> * [ plainTextPart $ LT.fromStrict body' ]* >>> * result <- try $ sendMailWithLogin' "smtp.gmail.com >>> "* >>> * 465 -- SSL port* >>> * ?sender_login?* >>> * ?sender_password?* >>> * msg :: IO (Either SomeException >>> ())* >>> * case result of* >>> * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* >>> * Right _ -> putStrLn "Sent email successfully."* >>> >>> >>> The program compiles, but when I run it, I get: >>> >>> *Exception caught: : Data.ByteString.hGetLine: end of file* >>> >>> I tried using the TLS port of 587, but then I just get an authentication >>> failure. Am I using the wrong library or is it just the wrong >>> configuration. Thanks. >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sumit.sahrawat.apm13 at iitbhu.ac.in Tue Apr 19 11:18:57 2016 From: sumit.sahrawat.apm13 at iitbhu.ac.in (Sumit Sahrawat, Maths & Computing, IIT (BHU)) Date: Tue, 19 Apr 2016 16:48:57 +0530 Subject: [Haskell-cafe] Existential quantification of config data types In-Reply-To: References: Message-ID: Yup, the only way would be to parse a possible list of alternatives. Should be simple with parsing libraries like parsec. try format1 <|> try format2 <|> ... Regards, Sumit -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Tue Apr 19 18:30:33 2016 From: david.feuer at gmail.com (David Feuer) Date: Tue, 19 Apr 2016 14:30:33 -0400 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? In-Reply-To: References: Message-ID: What I'm looking for is more limited than lazy IO or unsafeInterleaveIO, but it seems quite possible that there's no way to get just what I'm looking for with the IO type proper using GHC's implementation of IO. Lazy IO allows evaluation to drive action. When a thunk is forced, it may trigger I/O (spooky action at a distance). What I'm talking about is separating what actions are performed from what values are calculated from them. Here's a partial concept which won't actually compile because of the lazy pattern matches: data MyIO a = forall b . MyIO (b -> a) (IO b) instance Functor MyIO where fmap f ~(MyIO t m) = MyIO (f . t) m instance Applicative MyIO where pure a = MyIO (const a) (pure ()) MyIO t1 m1 <*> ~(MyIO t2 m2) = MyIO (\(r1, r2) -> t1 r1 (t2 r2)) ((,) <$> m1 <*> m2) instance Monad MyIO where ??? instance MonadFix MyIO where ??? On Tue, Apr 19, 2016 at 2:30 AM, David Turner wrote: > I suspect you're looking for something like lazy IO (or a similarly unsafe > cousin like unsafeInterleaveIO as featured in the definition of fixIO) > although I still remain a bit confused. > > The type of lazyMap :: (a -> b) -> IO a -> IO b is the same as for fmap, but > fmap is already as lazy as it can be without unsafeness: > > fmap (const ()) (return undefined) = return () > fmap (const ()) undefined = undefined > > You can't (safely) define lazyMap where lazyMap f ma doesn't have all the > real-world effects of ma before returning. If ma has infinitely many effects > then it's not going to return, because if it did then you'd have your hands > on something of pure type 'b' which continues to have real-world effects as > you evaluate it. This is, roughly speaking, lazy IO. > > On the other hand, you mention knot-tying and this is precisely what fixIO > is for. A slightly contrived example: > > import Control.Monad > import Control.Monad.Fix > > main :: IO () > main = do > fibs <- fibsIO > print $ fibs !! 10 > > fibsIO :: IO [Int] > fibsIO = mfix $ \fibs -> do > fibs' <- forM [2..10] $ \i -> do > putStrLn $ "Calculating fibs !! " ++ show i > return $ fibs !! (i-1) + fibs !! (i-2) > return $ 0:1:fibs' > > Note that I have to limit the number of actions for this to work - if it > said 'forM [2..] then there'd be infinitely many effects and it'd never > return. > > Hope that helps, > > David > > > > > > > On 19 April 2016 at 00:25, David Feuer wrote: >> >> lazyMap :: (a -> b) -> IO a -> IO b, hypothetically. >> >> Let me take a step back. There are two ways I know of to use the result of >> an IO action. The most common way, by far, is to use >>= to send it on to >> the next computation. The other notable way is to use fixIO. >> >> No part of the result of an IO action becomes available until that action >> "completes" (in the shady case of lazy IO, this may be immediate, but I'm >> ignoring lazy IO for this discussion). This causes the well-known >> inefficiency of mapM in IO: individual results cannot be consed until the >> entire computation is complete. It seems to cause much more painful effects >> for fixIO--lazy programming techniques may simply be unavailable. >> >> For example, it's possible for a pure computation using a queue in a >> single-threaded fashion to represent that queue as a list, tying the knot to >> pass the list of all enqueued elements to the beginning. If an IO >> computation wants to use a queue, this technique does not seem to be >> available. The knot can be tied with fixIO, but conses are delayed until >> it's too late--attempting to dequeue an element will block forever. >> >> I'm wondering if there's some way to make this sort of thing work, either >> with plain Haskell IO or some thin layer built on top. >> >> On Apr 18, 2016 5:12 PM, "David Turner" >> wrote: >>> >>> Sorry, you've lost me. I suspect you're trying to give a minimal example >>> of the problem you're having, but you've stripped away too much context. >>> What are lazyMap and f? At least, what are their types? >>> >>> On 18 Apr 2016 22:03, "David Feuer" wrote: >>>> >>>> Consider the implementation of `second` for pairs: >>>> >>>> second f ~(a,b) = (a, f b) >>>> >>>> Now >>>> >>>> fix $ second (3 :) >>>> >>>> Will be (undefined, [3,3,....]) >>>> >>>> Translating this to IO, I'd want >>>> >>>> lazyMap f undefined >>>> >>>> to produce as much as possible of the result, although it cannot produce >>>> the final State# RealWorld token. >>>> >>>> On Apr 18, 2016 4:47 PM, "David Turner" >>>> wrote: >>>>> >>>>> You can't know that the final result of the computation (x `seq` >>>>> (3:...)) will begin with 3, because sometimes it doesn't! More specifically, >>>>> it diverges (without yielding the 3) if x diverges. >>>>> >>>>> I don't think this is anything special about mfix: (let x = x `seq` >>>>> 3:... in x) also diverges for the same reason. >>>>> >>>>> Hope that helps, >>>>> >>>>> David >>>>> >>>>> On 18 Apr 2016 21:19, "David Feuer" wrote: >>>>>> >>>>>> If >>>>>> >>>>>> f :: a -> IO a >>>>>> >>>>>> for some a, and I want to use >>>>>> >>>>>> mfix f >>>>>> >>>>>> then f must not inspect its argument in any way, or the computation >>>>>> will get stuck. In some cases, this seems a bit harsh. For example, >>>>>> >>>>>> mfix (\x -> fmap (3 :) (x `seq` readLn)) >>>>>> >>>>>> looks perfectly reasonable. There is no need to inspect the return [] >>>>>> action to know that the final result of the computation will begin >>>>>> with 3:. Is there a lazy IO mapping function somewhere that can work >>>>>> such magic? >>>>>> _______________________________________________ >>>>>> Haskell-Cafe mailing list >>>>>> Haskell-Cafe at haskell.org >>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johndreaver at gmail.com Tue Apr 19 18:56:18 2016 From: johndreaver at gmail.com (David Reaver) Date: Tue, 19 Apr 2016 11:56:18 -0700 Subject: [Haskell-cafe] [ANN] Stratosphere: AWS CloudFormation EDSL in Haskell Message-ID: Github: https://github.com/frontrowed/stratosphere Hackage: https://hackage.haskell.org/package/stratosphere CloudFormation is a system that provisions and updates Amazon Web Services (AWS) resources based on declarative templates. Common criticisms of CloudFormation include the use of JSON as the template language and limited error-checking, often only available in the form of run-time errors and stack rollbacks. By wrapping templates in Haskell, we are able to easily construct them and help ensure correctness. The goals of stratosphere are to: - Build a Haskell EDSL to specify CloudFormation templates. Since it is embedded in Haskell, it is type-checked and generally much easier to work with than raw JSON. - Have a simple checking/linting system outside of the types that can find common errors in templates. - Be able to also read valid CloudFormation JSON templates so they can be type-checked. This also gives us free integration tests by using the huge amount of example templates available in the AWS docs. Most of the commonly used CloudFormation resources are implemented, and adding new resources is very straightforward. (We created a web scraper that generates a JSON file from a given CloudFormation documentation page URL, and from that we generate a Haskell module.) So far, we have implemented resources we use at Front Row Education, and we will add more resources over time. The library is very much in a usable state as-is. However, we want to make any sweeping changes while it is still young. If you have any suggestions at all, you want us to add your favorite resource, or if you find a bug, please file an issue on Github! Also, we want to give a huge thanks to Brendan Hay, the author of amazonka, for his ideas and feedback on the project. -------------- next part -------------- An HTML attachment was scrubbed... URL: From agocorona at gmail.com Tue Apr 19 19:21:24 2016 From: agocorona at gmail.com (Alberto G. Corona ) Date: Tue, 19 Apr 2016 21:21:24 +0200 Subject: [Haskell-cafe] [ANN] Stratosphere: AWS CloudFormation EDSL in Haskell In-Reply-To: References: Message-ID: Very nice job. I have tried AWS EC2 and I failed miserably since the permission system and his intricate configurations, his paranoid security, and their secret formulas for pricing are beyond an average human intelligence. It is possible to have an example stratosphere application that could configure and run a Haskell program in one or many EC2 nodes , close the instances and send back the results? Are there some elements still lacking to achieve such goal? 2016-04-19 20:56 GMT+02:00 David Reaver : > Github: https://github.com/frontrowed/stratosphere > Hackage: https://hackage.haskell.org/package/stratosphere > > CloudFormation is a system that provisions and updates Amazon Web Services > (AWS) resources based on declarative templates. Common criticisms of > CloudFormation include the use of JSON as the template language and limited > error-checking, often only available in the form of run-time errors and > stack > rollbacks. By wrapping templates in Haskell, we are able to easily > construct > them and help ensure correctness. > > The goals of stratosphere are to: > - Build a Haskell EDSL to specify CloudFormation templates. Since it is > embedded in Haskell, it is type-checked and generally much easier to work > with than raw JSON. > - Have a simple checking/linting system outside of the types that can find > common errors in templates. > - Be able to also read valid CloudFormation JSON templates so they can be > type-checked. This also gives us free integration tests by using the huge > amount of example templates available in the AWS docs. > > Most of the commonly used CloudFormation resources are implemented, and > adding > new resources is very straightforward. (We created a web scraper that > generates > a JSON file from a given CloudFormation documentation page URL, and from > that > we generate a Haskell module.) So far, we have implemented resources we > use at > Front Row Education, and we will add more resources over time. > > The library is very much in a usable state as-is. However, we want to make > any > sweeping changes while it is still young. If you have any suggestions at > all, > you want us to add your favorite resource, or if you find a bug, please > file an > issue on Github! > > Also, we want to give a huge thanks to Brendan Hay, the author of > amazonka, for > his ideas and feedback on the project. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From johndreaver at gmail.com Tue Apr 19 19:39:44 2016 From: johndreaver at gmail.com (David Reaver) Date: Tue, 19 Apr 2016 12:39:44 -0700 Subject: [Haskell-cafe] [ANN] Stratosphere: AWS CloudFormation EDSL in Haskell In-Reply-To: References: Message-ID: Thanks Alberto! You can certainly set up permissions and security groups on EC2 nodes using CloudFormation, run your job, and then tear down the CloudFormation stack. You can use stratosphere to specify the AWS resources like an EC2 instance, a VPC for it, some security groups, and an instance role. Then, you can use something like Ansible or even just a bash script to set up and run your job on that machine. Once it's done, you can tear down the stack you just built. We actually do something similar to what you said for running pgbadger on our Postgres RDS logs. Our logs can reach a few GB per hour, so downloading them to a local machine can be pretty time-consuming, and processing can take long as well. In order to get RDS logs, you need to have permissions to do so on AWS. I made a stack in stratosphere that creates a large EC2 instance for processing, a strict security group that locks down the instance, and also sets up a temporary user that only has permission to download RDS logs. Using Ansible, I then install pgbadger and its dependencies, download the logs, run pgbadger, and then download the results. Once the job is done, everything that was just created is destroyed. In summary, what you're saying is indeed possible and is a great use-case for CloudFormation. You just need to using something on top of stratosphere, as this library is simply used to build the CloudFormation templates. I'm considering adding support for running the templates directly in this library, maybe using amazonka-cloudformation. So far that hasn't been necessary for us. Also note that CloudFormation has a way to estimate the cost of your created resources: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-paying.html On Tue, Apr 19, 2016 at 12:21 PM, Alberto G. Corona wrote: > Very nice job. > > I have tried AWS EC2 and I failed miserably since the permission system > and his intricate configurations, his paranoid security, and their secret > formulas for pricing are beyond an average human intelligence. > > It is possible to have an example stratosphere application that could > configure and run a Haskell program in one or many EC2 nodes , close the > instances and send back the results? > > Are there some elements still lacking to achieve such goal? > > 2016-04-19 20:56 GMT+02:00 David Reaver : > >> Github: https://github.com/frontrowed/stratosphere >> Hackage: https://hackage.haskell.org/package/stratosphere >> >> CloudFormation is a system that provisions and updates Amazon Web Services >> (AWS) resources based on declarative templates. Common criticisms of >> CloudFormation include the use of JSON as the template language and >> limited >> error-checking, often only available in the form of run-time errors and >> stack >> rollbacks. By wrapping templates in Haskell, we are able to easily >> construct >> them and help ensure correctness. >> >> The goals of stratosphere are to: >> - Build a Haskell EDSL to specify CloudFormation templates. Since it is >> embedded in Haskell, it is type-checked and generally much easier to >> work >> with than raw JSON. >> - Have a simple checking/linting system outside of the types that can find >> common errors in templates. >> - Be able to also read valid CloudFormation JSON templates so they can be >> type-checked. This also gives us free integration tests by using the >> huge >> amount of example templates available in the AWS docs. >> >> Most of the commonly used CloudFormation resources are implemented, and >> adding >> new resources is very straightforward. (We created a web scraper that >> generates >> a JSON file from a given CloudFormation documentation page URL, and from >> that >> we generate a Haskell module.) So far, we have implemented resources we >> use at >> Front Row Education, and we will add more resources over time. >> >> The library is very much in a usable state as-is. However, we want to >> make any >> sweeping changes while it is still young. If you have any suggestions at >> all, >> you want us to add your favorite resource, or if you find a bug, please >> file an >> issue on Github! >> >> Also, we want to give a huge thanks to Brendan Hay, the author of >> amazonka, for >> his ideas and feedback on the project. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > > > -- > Alberto. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dorde.grbic at gmail.com Tue Apr 19 21:00:16 2016 From: dorde.grbic at gmail.com (=?UTF-8?B?xJBvcsSRZSBHcmJpxIc=?=) Date: Tue, 19 Apr 2016 23:00:16 +0200 Subject: [Haskell-cafe] ghc-mod errors in Emacs Message-ID: Greetings dear Haskell community, I'm trying to use Spacemacs for Haskell development but as soon as I open a .hs file ghc-mod dumps errors: ghc-mod: : cannot satisfy -package-id base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 (use -v for more information) : cannot satisfy -package-id base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 (use -v for more information) : cannot satisfy -package-id base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 (use -v for more information) I have ghc-mod version: 5.5.0.0 compiled by GHC 7.8.4. GHC version : 7.8.4 Emacs: 24.5.1 Spacemacs: 0.105.18 OS: Ubuntu 14.04.4 LTS Any help is appreciated, Djordje Grbic -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmartin at eecs.berkeley.edu Tue Apr 19 23:24:26 2016 From: jmartin at eecs.berkeley.edu (James M) Date: Tue, 19 Apr 2016 16:24:26 -0700 Subject: [Haskell-cafe] Typeclass Constraint Causing Typechecker to Fail Message-ID: Below I have a contrived example. Please do not take this to be real world code. f :: (Show a) => Int -> (Int -> a) -> Int -> IO a f i g x = do print i return $ g (x + i) foo :: Bool -> IO (Either [Int] [String]) foo b = do let helper = f 2 if b then Left <$> sequence (fmap (helper negate) [0,1]) else Right <$> sequence (fmap (helper show) [0,1]) The above will fail stating Example.hs:14:35: Couldn't match type ?Int? with ?[Char]? Expected type: Int -> IO String Actual type: Int -> IO Int In the first argument of ?fmap?, namely ?(helper show)? In the first argument of ?sequence?, namely ?(fmap (helper show) [0, 1])? Example.hs:14:42: Couldn't match type ?[Char]? with ?Int? Expected type: Int -> Int Actual type: Int -> String In the first argument of ?helper?, namely ?show? In the first argument of ?fmap?, namely ?(helper show)? However, if I simply change f's type signature to not have the typeclass constraint, the type checker is happy: f :: Int -> (Int -> a) -> Int -> IO a Another possibility to remove the problem is to remove the let statement and instead put the entire expression in. foo :: Bool -> IO (Either [Int] [String]) foo b = do if b then Left <$> sequence (fmap (f 2 negate) [0,1]) else Right <$> sequence (fmap (f 2 show) [0,1]) This seems to be a bug in the typechecker, and maybe it is a well known issue. Can someone please confirm that this is a bug and whether or not it is known? James -------------- next part -------------- An HTML attachment was scrubbed... URL: From kane at kane.cx Tue Apr 19 23:58:56 2016 From: kane at kane.cx (David Kraeutmann) Date: Wed, 20 Apr 2016 01:58:56 +0200 Subject: [Haskell-cafe] Typeclass Constraint Causing Typechecker to Fail In-Reply-To: References: Message-ID: <5716C640.20309@kane.cx> The dreaded monomorphism restriction strikes again, namely during the binding of let helper = f 2. Adding an explicit type signature let helper :: Show a => (Int -> a) -> Int -> IO a helper = f 2 or -XNoMonomorphismRestriction does the trick. On 4/20/2016 1:24 AM, James M wrote: > Below I have a contrived example. Please do not take this to be real world > code. > > f :: (Show a) => Int -> (Int -> a) -> Int -> IO a > f i g x = do > print i > return $ g (x + i) > > foo :: Bool -> IO (Either [Int] [String]) > foo b = do > let helper = f 2 > if b then > Left <$> sequence (fmap (helper negate) [0,1]) > else > Right <$> sequence (fmap (helper show) [0,1]) > > The above will fail stating > > Example.hs:14:35: > > Couldn't match type ?Int? with ?[Char]? > > Expected type: Int -> IO String > > Actual type: Int -> IO Int > > In the first argument of ?fmap?, namely ?(helper show)? > > In the first argument of ?sequence?, namely > > ?(fmap (helper show) [0, 1])? > > > Example.hs:14:42: > > Couldn't match type ?[Char]? with ?Int? > > Expected type: Int -> Int > > Actual type: Int -> String > > In the first argument of ?helper?, namely ?show? > > In the first argument of ?fmap?, namely ?(helper show)? > > > However, if I simply change f's type signature to not have the typeclass > constraint, the type checker is happy: > f :: Int -> (Int -> a) -> Int -> IO a > > Another possibility to remove the problem is to remove the let statement > and instead put the entire expression in. > > foo :: Bool -> IO (Either [Int] [String]) > foo b = do > if b then > Left <$> sequence (fmap (f 2 negate) [0,1]) > else > Right <$> sequence (fmap (f 2 show) [0,1]) > > This seems to be a bug in the typechecker, and maybe it is a well known > issue. > > Can someone please confirm that this is a bug and whether or not it is > known? > > James > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4291 bytes Desc: S/MIME Cryptographic Signature URL: From b at chreekat.net Tue Apr 19 23:59:30 2016 From: b at chreekat.net (Bryan Richter) Date: Tue, 19 Apr 2016 16:59:30 -0700 Subject: [Haskell-cafe] Typeclass Constraint Causing Typechecker to Fail In-Reply-To: References: Message-ID: <20160419235930.GJ16692@fuzzbomb> On Tue, Apr 19, 2016 at 04:24:26PM -0700, James M wrote: > Below I have a contrived example. Please do not take this to be real > world code. > > f :: (Show a) => Int -> (Int -> a) -> Int -> IO a > f i g x = do > print i > return $ g (x + i) > > foo :: Bool -> IO (Either [Int] [String]) > foo b = do > let helper = f 2 > if b then > Left <$> sequence (fmap (helper negate) [0,1]) > else > Right <$> sequence (fmap (helper show) [0,1]) > > The above will fail stating... > > > > This seems to be a bug in the typechecker, and maybe it is a well > known issue. > > Can someone please confirm that this is a bug and whether or not it > is known? I believe you have discovered everyone's favorite Haskell feature: https://wiki.haskell.org/Monomorphism_restriction -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Digital signature URL: From dani at dpwright.com Wed Apr 20 06:32:48 2016 From: dani at dpwright.com (Daniel P. Wright) Date: Wed, 20 Apr 2016 15:32:48 +0900 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Hello David, > The only thing I noticed with Gmail is that in order to work it requires the sender's account to toggle this setting: > Allow less secure apps: OFF That does sound unusual! Is my understanding you correctly that HaskellNet doesn't work UNLESS you disallow less secure apps? Or is it the other (more intuitive) way round? (i.e. HaskellNet is being considered a "less secure" app and thus being disallowed). If it's the former it's not a massive priority even if it isn't ideal. If it's the latter it should probably be fixed. I'll try and look at it when I get the chance -- feel free to file an issue on HaskellNet-SSL in github. By the way, where is that setting in gmail? I had a look through the settings but couldn't see it. This might be because I'm using the Google Apps version of Gmail, not the public "@gmail.com" one. -Dani. 2016-04-19 17:13 GMT+09:00 David Escobar : > Actually Daniel, I'm glad you mentioned it. *HaskellNet* and > *HaskellNet-SSL* actually worked for me! Thank you for that! > > The only thing I noticed with Gmail is that in order to work it requires > the sender's account to toggle this setting: > Allow less secure apps: OFF > > Doesn't seem ideal, but I'm not sure if that's a fault of the library > itself or just the way it is with generic 3rd party apps that aren't > somehow registered with Google. But in any case, when I try it with another > Amazon AWS account, it doesn't have that problem, so it's all good since > that's the real account I wanted to get it working with anyway (Gmail was > just a more convenient "testing" platform). > > In any case, here is the short generic code that works for future > reference so that hopefully others don't have to go through the same > process just to send an email. Thanks again Daniel, and thanks to everyone > else for their answers as well! > > P.S. the *sslLogToConsole* option is great for seeing the handshaking > going on with the SMTP server. > > *main :: IO ()* > *main = doSMTPSTARTTLSWithSettings "smtp.gmail.com > " settings $ \conn -> do* > * authSucceed <- authenticate LOGIN "gmail_login" "gmail_password" conn* > * if authSucceed* > * then do* > * putStrLn "Sending email..."* > * sendPlainTextMail "recipient at somewhere.com > "* > * "sender at somewhere_else.com > "* > * "Haskell Email"* > * "I can finally send email from > Haskell now!!"* > * conn* > * else print "Authentication failed."* > * where settings = defaultSettingsSMTPSTARTTLS { sslPort = 587, > sslLogToConsole = True }* > > > On Mon, Apr 18, 2016 at 10:59 PM, Daniel P. Wright > wrote: > >> Not to throw another spanner in the works with Yet Another Package to >> try, but another option is HaskellNet[1] with HaskellNet-SSL[2] for your >> TLS connection. I originally wrote the HaskellNet-SSL wrapper but it's >> currently being maintained by Leza Morais Lutonda. It works with gmail. I >> haven't tried any of the other SMTP options and I mostly used it for IMAP, >> not SMTP, so I can't compare them directly or recommend one over the other >> -- just throwing it out there as another option! >> >> [1]: http://hackage.haskell.org/package/HaskellNet >> [2]: http://hackage.haskell.org/package/HaskellNet-SSL >> >> 2016-04-19 6:42 GMT+09:00 David Escobar : >> >>> Hi everyone, >>> I'm trying to use the *Network.Mail.SMTP* library to send email: >>> >>> *{-# LANGUAGE OverloadedStrings #-}* >>> >>> *module Main where* >>> >>> *import Control.Exception* >>> >>> *import qualified Data.Text as T* >>> *import qualified Data.Text.Lazy as LT* >>> *import Network.Mail.SMTP* >>> >>> *main :: IO ()* >>> *main = do* >>> * sendEmail (?Person sender?, ?sender at somewhere.com >>> ?)* >>> * [(?Person recipient?, ?recipient at somewhere.com >>> ?)]* >>> * "Test email"* >>> * "Some message goes here."* >>> >>> >>> *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> T.Text >>> -> IO ()* >>> *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* >>> * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) >>> toEmail) toAddresses* >>> * msg = simpleMail (Address (Just fromName) fromEmail)* >>> * toNameAddrs* >>> * []* >>> * []* >>> * subject'* >>> * [ plainTextPart $ LT.fromStrict body' ]* >>> * result <- try $ sendMailWithLogin' "smtp.gmail.com >>> "* >>> * 465 -- SSL port* >>> * ?sender_login?* >>> * ?sender_password?* >>> * msg :: IO (Either SomeException >>> ())* >>> * case result of* >>> * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* >>> * Right _ -> putStrLn "Sent email successfully."* >>> >>> >>> The program compiles, but when I run it, I get: >>> >>> *Exception caught: : Data.ByteString.hGetLine: end of file* >>> >>> I tried using the TLS port of 587, but then I just get an authentication >>> failure. Am I using the wrong library or is it just the wrong >>> configuration. Thanks. >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spam at scientician.net Wed Apr 20 06:56:48 2016 From: spam at scientician.net (Bardur Arantsson) Date: Wed, 20 Apr 2016 08:56:48 +0200 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: On 04/20/2016 08:32 AM, Daniel P. Wright wrote: > Hello David, > >> The only thing I noticed with Gmail is that in order to work it requires > the sender's account to toggle this setting: >> Allow less secure apps: OFF > > That does sound unusual! Is my understanding you correctly that HaskellNet > doesn't work UNLESS you disallow less secure apps? Or is it the other > (more intuitive) way round? (i.e. HaskellNet is being considered a "less > secure" app and thus being disallowed). It's not particularly sinister... It's is simply that IMAP/SMTP do not have authentication options that are "secure enough" for Google[1]. Or perhaps rather that they at least must allow less secure authentication options per their respective standards/RFCs. Regards, [1] Basically they don't enforce two-factor auth. From dani at dpwright.com Wed Apr 20 07:00:13 2016 From: dani at dpwright.com (Daniel P. Wright) Date: Wed, 20 Apr 2016 16:00:13 +0900 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Bardur, Ah, ok, that makes sense. Thanks for the clarification. -Dani. 2016-04-20 15:56 GMT+09:00 Bardur Arantsson : > On 04/20/2016 08:32 AM, Daniel P. Wright wrote: > > Hello David, > > > >> The only thing I noticed with Gmail is that in order to work it requires > > the sender's account to toggle this setting: > >> Allow less secure apps: OFF > > > > That does sound unusual! Is my understanding you correctly that > HaskellNet > > doesn't work UNLESS you disallow less secure apps? Or is it the other > > (more intuitive) way round? (i.e. HaskellNet is being considered a "less > > secure" app and thus being disallowed). > > It's not particularly sinister... > > It's is simply that IMAP/SMTP do not have authentication options that > are "secure enough" for Google[1]. Or perhaps rather that they at least > must allow less secure authentication options per their respective > standards/RFCs. > > Regards, > > [1] Basically they don't enforce two-factor auth. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brendan.g.hay at gmail.com Wed Apr 20 08:00:58 2016 From: brendan.g.hay at gmail.com (Brendan Hay) Date: Wed, 20 Apr 2016 10:00:58 +0200 Subject: [Haskell-cafe] [ANN] Stratosphere: AWS CloudFormation EDSL in Haskell In-Reply-To: References: Message-ID: Great work, David. Congratulations on the release! On 19 April 2016 at 21:39, David Reaver wrote: > Thanks Alberto! > > You can certainly set up permissions and security groups on EC2 nodes > using CloudFormation, run your job, and then tear down the CloudFormation > stack. You can use stratosphere to specify the AWS resources like an EC2 > instance, a VPC for it, some security groups, and an instance role. Then, > you can use something like Ansible or even just a bash script to set up and > run your job on that machine. Once it's done, you can tear down the stack > you just built. > > We actually do something similar to what you said for running pgbadger on > our Postgres RDS logs. Our logs can reach a few GB per hour, so downloading > them to a local machine can be pretty time-consuming, and processing can > take long as well. In order to get RDS logs, you need to have permissions > to do so on AWS. I made a stack in stratosphere that creates a large EC2 > instance for processing, a strict security group that locks down the > instance, and also sets up a temporary user that only has permission to > download RDS logs. Using Ansible, I then install pgbadger and its > dependencies, download the logs, run pgbadger, and then download the > results. Once the job is done, everything that was just created is > destroyed. > > In summary, what you're saying is indeed possible and is a great use-case > for CloudFormation. You just need to using something on top of > stratosphere, as this library is simply used to build the CloudFormation > templates. I'm considering adding support for running the templates > directly in this library, maybe using amazonka-cloudformation. So far that > hasn't been necessary for us. > > Also note that CloudFormation has a way to estimate the cost of your > created resources: > http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-paying.html > > On Tue, Apr 19, 2016 at 12:21 PM, Alberto G. Corona > wrote: > >> Very nice job. >> >> I have tried AWS EC2 and I failed miserably since the permission system >> and his intricate configurations, his paranoid security, and their secret >> formulas for pricing are beyond an average human intelligence. >> >> It is possible to have an example stratosphere application that could >> configure and run a Haskell program in one or many EC2 nodes , close the >> instances and send back the results? >> >> Are there some elements still lacking to achieve such goal? >> >> 2016-04-19 20:56 GMT+02:00 David Reaver : >> >>> Github: https://github.com/frontrowed/stratosphere >>> Hackage: https://hackage.haskell.org/package/stratosphere >>> >>> CloudFormation is a system that provisions and updates Amazon Web >>> Services >>> (AWS) resources based on declarative templates. Common criticisms of >>> CloudFormation include the use of JSON as the template language and >>> limited >>> error-checking, often only available in the form of run-time errors and >>> stack >>> rollbacks. By wrapping templates in Haskell, we are able to easily >>> construct >>> them and help ensure correctness. >>> >>> The goals of stratosphere are to: >>> - Build a Haskell EDSL to specify CloudFormation templates. Since it is >>> embedded in Haskell, it is type-checked and generally much easier to >>> work >>> with than raw JSON. >>> - Have a simple checking/linting system outside of the types that can >>> find >>> common errors in templates. >>> - Be able to also read valid CloudFormation JSON templates so they can be >>> type-checked. This also gives us free integration tests by using the >>> huge >>> amount of example templates available in the AWS docs. >>> >>> Most of the commonly used CloudFormation resources are implemented, and >>> adding >>> new resources is very straightforward. (We created a web scraper that >>> generates >>> a JSON file from a given CloudFormation documentation page URL, and from >>> that >>> we generate a Haskell module.) So far, we have implemented resources we >>> use at >>> Front Row Education, and we will add more resources over time. >>> >>> The library is very much in a usable state as-is. However, we want to >>> make any >>> sweeping changes while it is still young. If you have any suggestions at >>> all, >>> you want us to add your favorite resource, or if you find a bug, please >>> file an >>> issue on Github! >>> >>> Also, we want to give a huge thanks to Brendan Hay, the author of >>> amazonka, for >>> his ideas and feedback on the project. >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> >> >> -- >> Alberto. >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar1976 at gmail.com Wed Apr 20 08:02:42 2016 From: davidescobar1976 at gmail.com (David Escobar) Date: Wed, 20 Apr 2016 01:02:42 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Yes, I meant that it only worked by turning less secure apps ON. Sorry for the confusion. From Bardur's comment, it sounds like it's all good. The setting for this is actually outside of Gmail, under *myaccount.google.com * and then you go to "Connected apps & sites". Thanks again. David On Tue, Apr 19, 2016 at 11:32 PM, Daniel P. Wright wrote: > Hello David, > > > The only thing I noticed with Gmail is that in order to work it requires > the sender's account to toggle this setting: > > Allow less secure apps: OFF > > That does sound unusual! Is my understanding you correctly that > HaskellNet doesn't work UNLESS you disallow less secure apps? Or is it the > other (more intuitive) way round? (i.e. HaskellNet is being considered a > "less secure" app and thus being disallowed). > > If it's the former it's not a massive priority even if it isn't ideal. If > it's the latter it should probably be fixed. I'll try and look at it when > I get the chance -- feel free to file an issue on HaskellNet-SSL in github. > > By the way, where is that setting in gmail? I had a look through the > settings but couldn't see it. This might be because I'm using the Google > Apps version of Gmail, not the public "@gmail.com" one. > > -Dani. > > 2016-04-19 17:13 GMT+09:00 David Escobar : > >> Actually Daniel, I'm glad you mentioned it. *HaskellNet* and >> *HaskellNet-SSL* actually worked for me! Thank you for that! >> >> The only thing I noticed with Gmail is that in order to work it requires >> the sender's account to toggle this setting: >> Allow less secure apps: OFF >> >> Doesn't seem ideal, but I'm not sure if that's a fault of the library >> itself or just the way it is with generic 3rd party apps that aren't >> somehow registered with Google. But in any case, when I try it with another >> Amazon AWS account, it doesn't have that problem, so it's all good since >> that's the real account I wanted to get it working with anyway (Gmail was >> just a more convenient "testing" platform). >> >> In any case, here is the short generic code that works for future >> reference so that hopefully others don't have to go through the same >> process just to send an email. Thanks again Daniel, and thanks to everyone >> else for their answers as well! >> >> P.S. the *sslLogToConsole* option is great for seeing the handshaking >> going on with the SMTP server. >> >> *main :: IO ()* >> *main = doSMTPSTARTTLSWithSettings "smtp.gmail.com >> " settings $ \conn -> do* >> * authSucceed <- authenticate LOGIN "gmail_login" "gmail_password" conn* >> * if authSucceed* >> * then do* >> * putStrLn "Sending email..."* >> * sendPlainTextMail "recipient at somewhere.com >> "* >> * "sender at somewhere_else.com >> "* >> * "Haskell Email"* >> * "I can finally send email from >> Haskell now!!"* >> * conn* >> * else print "Authentication failed."* >> * where settings = defaultSettingsSMTPSTARTTLS { sslPort = 587, >> sslLogToConsole = True }* >> >> >> On Mon, Apr 18, 2016 at 10:59 PM, Daniel P. Wright >> wrote: >> >>> Not to throw another spanner in the works with Yet Another Package to >>> try, but another option is HaskellNet[1] with HaskellNet-SSL[2] for your >>> TLS connection. I originally wrote the HaskellNet-SSL wrapper but it's >>> currently being maintained by Leza Morais Lutonda. It works with gmail. I >>> haven't tried any of the other SMTP options and I mostly used it for IMAP, >>> not SMTP, so I can't compare them directly or recommend one over the other >>> -- just throwing it out there as another option! >>> >>> [1]: http://hackage.haskell.org/package/HaskellNet >>> [2]: http://hackage.haskell.org/package/HaskellNet-SSL >>> >>> 2016-04-19 6:42 GMT+09:00 David Escobar : >>> >>>> Hi everyone, >>>> I'm trying to use the *Network.Mail.SMTP* library to send email: >>>> >>>> *{-# LANGUAGE OverloadedStrings #-}* >>>> >>>> *module Main where* >>>> >>>> *import Control.Exception* >>>> >>>> *import qualified Data.Text as T* >>>> *import qualified Data.Text.Lazy as LT* >>>> *import Network.Mail.SMTP* >>>> >>>> *main :: IO ()* >>>> *main = do* >>>> * sendEmail (?Person sender?, ?sender at somewhere.com >>>> ?)* >>>> * [(?Person recipient?, ?recipient at somewhere.com >>>> ?)]* >>>> * "Test email"* >>>> * "Some message goes here."* >>>> >>>> >>>> *sendEmail :: (T.Text, T.Text) -> [(T.Text, T.Text)] -> T.Text -> >>>> T.Text -> IO ()* >>>> *sendEmail (fromName, fromEmail) toAddresses subject' body' = do* >>>> * let toNameAddrs = map (\(toName, toEmail) -> Address (Just toName) >>>> toEmail) toAddresses* >>>> * msg = simpleMail (Address (Just fromName) fromEmail)* >>>> * toNameAddrs* >>>> * []* >>>> * []* >>>> * subject'* >>>> * [ plainTextPart $ LT.fromStrict body' ]* >>>> * result <- try $ sendMailWithLogin' "smtp.gmail.com >>>> "* >>>> * 465 -- SSL port* >>>> * ?sender_login?* >>>> * ?sender_password?* >>>> * msg :: IO (Either SomeException >>>> ())* >>>> * case result of* >>>> * Left e -> putStrLn $ "Exception caught: " ++ (displayException e)* >>>> * Right _ -> putStrLn "Sent email successfully."* >>>> >>>> >>>> The program compiles, but when I run it, I get: >>>> >>>> *Exception caught: : Data.ByteString.hGetLine: end of file* >>>> >>>> I tried using the TLS port of 587, but then I just get an >>>> authentication failure. Am I using the wrong library or is it just the >>>> wrong configuration. Thanks. >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From d12frosted at gmail.com Wed Apr 20 08:48:21 2016 From: d12frosted at gmail.com (Boris) Date: Wed, 20 Apr 2016 11:48:21 +0300 Subject: [Haskell-cafe] ghc-mod errors in Emacs In-Reply-To: References: Message-ID: Hey ?or?e, Do you use stack? If so, make sure that the project you are working on really uses `GHC 7.8.4`. P. S. Just shot in the air :-P ~ d12frosted On Wed, Apr 20, 2016 at 12:00 AM, ?or?e Grbi? wrote: > Greetings dear Haskell community, > > I'm trying to use Spacemacs for Haskell development > but as soon as I open a .hs file ghc-mod dumps errors: > > ghc-mod: : cannot satisfy -package-id > base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 > (use -v for more information) > : cannot satisfy -package-id > base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 > (use -v for more information) > : cannot satisfy -package-id > base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 > (use -v for more information) > > I have ghc-mod version: 5.5.0.0 compiled by GHC 7.8.4. > GHC version : 7.8.4 > Emacs: 24.5.1 > Spacemacs: 0.105.18 > OS: Ubuntu 14.04.4 LTS > > Any help is appreciated, > > Djordje Grbic > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From agocorona at gmail.com Wed Apr 20 09:30:14 2016 From: agocorona at gmail.com (Alberto G. Corona ) Date: Wed, 20 Apr 2016 11:30:14 +0200 Subject: [Haskell-cafe] [ANN] Stratosphere: AWS CloudFormation EDSL in Haskell In-Reply-To: References: Message-ID: David. Thanks a lot for the hints. I looked at some CloudFormation scripts and they look even more horrendous than what I have imagined. 2016-04-19 21:39 GMT+02:00 David Reaver : > Thanks Alberto! > > You can certainly set up permissions and security groups on EC2 nodes > using CloudFormation, run your job, and then tear down the CloudFormation > stack. You can use stratosphere to specify the AWS resources like an EC2 > instance, a VPC for it, some security groups, and an instance role. Then, > you can use something like Ansible or even just a bash script to set up and > run your job on that machine. Once it's done, you can tear down the stack > you just built. > > We actually do something similar to what you said for running pgbadger on > our Postgres RDS logs. Our logs can reach a few GB per hour, so downloading > them to a local machine can be pretty time-consuming, and processing can > take long as well. In order to get RDS logs, you need to have permissions > to do so on AWS. I made a stack in stratosphere that creates a large EC2 > instance for processing, a strict security group that locks down the > instance, and also sets up a temporary user that only has permission to > download RDS logs. Using Ansible, I then install pgbadger and its > dependencies, download the logs, run pgbadger, and then download the > results. Once the job is done, everything that was just created is > destroyed. > > In summary, what you're saying is indeed possible and is a great use-case > for CloudFormation. You just need to using something on top of > stratosphere, as this library is simply used to build the CloudFormation > templates. I'm considering adding support for running the templates > directly in this library, maybe using amazonka-cloudformation. So far that > hasn't been necessary for us. > > Also note that CloudFormation has a way to estimate the cost of your > created resources: > http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-paying.html > > On Tue, Apr 19, 2016 at 12:21 PM, Alberto G. Corona > wrote: > >> Very nice job. >> >> I have tried AWS EC2 and I failed miserably since the permission system >> and his intricate configurations, his paranoid security, and their secret >> formulas for pricing are beyond an average human intelligence. >> >> It is possible to have an example stratosphere application that could >> configure and run a Haskell program in one or many EC2 nodes , close the >> instances and send back the results? >> >> Are there some elements still lacking to achieve such goal? >> >> 2016-04-19 20:56 GMT+02:00 David Reaver : >> >>> Github: https://github.com/frontrowed/stratosphere >>> Hackage: https://hackage.haskell.org/package/stratosphere >>> >>> CloudFormation is a system that provisions and updates Amazon Web >>> Services >>> (AWS) resources based on declarative templates. Common criticisms of >>> CloudFormation include the use of JSON as the template language and >>> limited >>> error-checking, often only available in the form of run-time errors and >>> stack >>> rollbacks. By wrapping templates in Haskell, we are able to easily >>> construct >>> them and help ensure correctness. >>> >>> The goals of stratosphere are to: >>> - Build a Haskell EDSL to specify CloudFormation templates. Since it is >>> embedded in Haskell, it is type-checked and generally much easier to >>> work >>> with than raw JSON. >>> - Have a simple checking/linting system outside of the types that can >>> find >>> common errors in templates. >>> - Be able to also read valid CloudFormation JSON templates so they can be >>> type-checked. This also gives us free integration tests by using the >>> huge >>> amount of example templates available in the AWS docs. >>> >>> Most of the commonly used CloudFormation resources are implemented, and >>> adding >>> new resources is very straightforward. (We created a web scraper that >>> generates >>> a JSON file from a given CloudFormation documentation page URL, and from >>> that >>> we generate a Haskell module.) So far, we have implemented resources we >>> use at >>> Front Row Education, and we will add more resources over time. >>> >>> The library is very much in a usable state as-is. However, we want to >>> make any >>> sweeping changes while it is still young. If you have any suggestions at >>> all, >>> you want us to add your favorite resource, or if you find a bug, please >>> file an >>> issue on Github! >>> >>> Also, we want to give a huge thanks to Brendan Hay, the author of >>> amazonka, for >>> his ideas and feedback on the project. >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> >> >> -- >> Alberto. >> > > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From giacomo at tesio.it Wed Apr 20 17:06:58 2016 From: giacomo at tesio.it (Giacomo Tesio) Date: Wed, 20 Apr 2016 19:06:58 +0200 Subject: [Haskell-cafe] Hugs In-Reply-To: References: Message-ID: 2016-04-13 17:51 GMT+02:00 David Feuer : > Yes, this is all a bit tongue-in-cheek, but I really do think that > pointing students to an unmaintained language implementation (regardless of > the pedagogical reasons) has negative consequences for the functional > programming community as a whole. > Today I was looking for a simplified version of Haskell that could compete in size with Lua or Wren. Nothing exist. I thought: oh... but what about Hugs98? Not Lua sized, but still better than GHC! Let see the age of the last related mail in haskell-cafe... you can't imagine my surprise reading this thread! GHC *is* too complex for a wide variety of use case. Porting Hugs to an new operative system used to be approachable for a single programmer, GHC have never been. Is this a language issue? I don't think so... but apparently, despite the abundance of language hackers in the Haskell community, nobody still tried to prove that an interpreter for the core Haskell language can be written in a reasonable amount of C code. Thus, to my money (and admittedly for my own use cases), if somebody renew the interest around a simpler Haskell implementation, he's going to have a really *positive *effect. Giacomo PS: if somebody knows about a similar project please drop me a line (Helium does not fit the requirements, as it depends on GHC itself). -------------- next part -------------- An HTML attachment was scrubbed... URL: From _deepfire at feelingofgreen.ru Wed Apr 20 17:15:17 2016 From: _deepfire at feelingofgreen.ru (Kosyrev Serge) Date: Wed, 20 Apr 2016 20:15:17 +0300 Subject: [Haskell-cafe] Hugs In-Reply-To: (Giacomo Tesio's message of "Wed, 20 Apr 2016 19:06:58 +0200") References: Message-ID: <878u089p7e.fsf@feelingofgreen.ru> Giacomo Tesio writes: > Is this a language issue? > I don't think so... but apparently, despite the abundance of language > hackers in the Haskell community, nobody still tried to prove that an > interpreter for the core Haskell language can be written in a > reasonable amount of C code. What is the value of using C as an implementation language [1]? Shouldn't there be intrinsic value in a self-hosted implementation? -- ? ???????e? / respectfully, ??????? ?????? -- 1. ..resource efficiency aside.. From dorde.grbic at gmail.com Wed Apr 20 17:46:04 2016 From: dorde.grbic at gmail.com (=?UTF-8?B?xJBvcsSRZSBHcmJpxIc=?=) Date: Wed, 20 Apr 2016 19:46:04 +0200 Subject: [Haskell-cafe] ghc-mod errors in Emacs In-Reply-To: References: Message-ID: Hi guys, Yes my .cabal file was a problem. I've reinitialized the project with Stack and everything seems to be working. Unfortunately, I've accidentally deleted the old .cabal file to show what was wrong. Thanks a lot, Djordje On 20 April 2016 at 10:48, Boris wrote: > Hey ?or?e, > > Do you use stack? If so, make sure that the project you are working on > really uses `GHC 7.8.4`. > > P. S. Just shot in the air :-P > > ~ d12frosted > > On Wed, Apr 20, 2016 at 12:00 AM, ?or?e Grbi? > wrote: > >> Greetings dear Haskell community, >> >> I'm trying to use Spacemacs for Haskell development >> but as soon as I open a .hs file ghc-mod dumps errors: >> >> ghc-mod: : cannot satisfy -package-id >> base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 >> (use -v for more information) >> : cannot satisfy -package-id >> base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 >> (use -v for more information) >> : cannot satisfy -package-id >> base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 >> (use -v for more information) >> >> I have ghc-mod version: 5.5.0.0 compiled by GHC 7.8.4. >> GHC version : 7.8.4 >> Emacs: 24.5.1 >> Spacemacs: 0.105.18 >> OS: Ubuntu 14.04.4 LTS >> >> Any help is appreciated, >> >> Djordje Grbic >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Wed Apr 20 17:52:00 2016 From: roma at ro-che.info (Roman Cheplyaka) Date: Wed, 20 Apr 2016 20:52:00 +0300 Subject: [Haskell-cafe] Hugs In-Reply-To: References: Message-ID: <5717C1C0.2000201@ro-che.info> On 04/20/2016 08:06 PM, Giacomo Tesio wrote: > 2016-04-13 17:51 GMT+02:00 David Feuer >: > > Yes, this is all a bit tongue-in-cheek, but I really do think that > pointing students to an unmaintained language implementation > (regardless of the pedagogical reasons) has negative consequences > for the functional programming community as a whole. > > > Today I was looking for a simplified version of Haskell that could > compete in size with Lua or Wren. > Nothing exist. > > I thought: oh... but what about Hugs98? Not Lua sized, but still better > than GHC! > Let see the age of the last related mail in haskell-cafe... you can't > imagine my surprise reading this thread! > > GHC *is* too complex for a wide variety of use case. > Porting Hugs to an new operative system used to be approachable for a > single programmer, GHC have never been. > > Is this a language issue? > I don't think so... but apparently, despite the abundance of language > hackers in the Haskell community, nobody still tried to prove that an > interpreter for the core Haskell language can be written in a reasonable > amount of C code. You are contradicting yourself. Mark P Jones and other "language hackers" who contributed to Hugs have already proven that. That no-one seems to be willing to maintain Hugs may indicate that there aren't as many use cases as you claim. > Thus, to my money (and admittedly for my own use cases), if somebody > renew the interest around a simpler Haskell implementation, he's going > to have a really *positive *effect. Would you put your money where your mouth is? I'm sure you would find someone who could maintain and improve Hugs for you. Roman From karel.gardas at centrum.cz Wed Apr 20 18:30:08 2016 From: karel.gardas at centrum.cz (Karel Gardas) Date: Wed, 20 Apr 2016 20:30:08 +0200 Subject: [Haskell-cafe] Hugs In-Reply-To: <878u089p7e.fsf@feelingofgreen.ru> References: <878u089p7e.fsf@feelingofgreen.ru> Message-ID: <5717CAB0.2070004@centrum.cz> On 04/20/16 07:15 PM, Kosyrev Serge wrote: > Giacomo Tesio writes: >> Is this a language issue? >> I don't think so... but apparently, despite the abundance of language >> hackers in the Haskell community, nobody still tried to prove that an >> interpreter for the core Haskell language can be written in a >> reasonable amount of C code. > > What is the value of using C as an implementation language [1]? > Some OSes are C-centric so... > Shouldn't there be intrinsic value in a self-hosted implementation? ...bootstraping Haskell from Haskell raises some concerns. At least IIRC the situation in OpenBSD -- if I understand this correctly. Karel From giacomo at tesio.it Wed Apr 20 22:17:55 2016 From: giacomo at tesio.it (Giacomo Tesio) Date: Thu, 21 Apr 2016 00:17:55 +0200 Subject: [Haskell-cafe] Hugs In-Reply-To: <5717CAB0.2070004@centrum.cz> References: <878u089p7e.fsf@feelingofgreen.ru> <5717CAB0.2070004@centrum.cz> Message-ID: The value of C as an implementation language is it's portability. Also usage as embedded language in many applications is easier with C. Self hosting is valuable as a proof that a compiler (and the compiled language) can be used for a complex real world program. But it does not help with portability. Giacomo 2016-04-20 20:30 GMT+02:00 Karel Gardas : > On 04/20/16 07:15 PM, Kosyrev Serge wrote: > >> Giacomo Tesio writes: >> >>> Is this a language issue? >>> I don't think so... but apparently, despite the abundance of language >>> hackers in the Haskell community, nobody still tried to prove that an >>> interpreter for the core Haskell language can be written in a >>> reasonable amount of C code. >>> >> >> What is the value of using C as an implementation language [1]? >> >> > Some OSes are C-centric so... > > > Shouldn't there be intrinsic value in a self-hosted implementation? >> > > ...bootstraping Haskell from Haskell raises some concerns. At least IIRC > the situation in OpenBSD -- if I understand this correctly. > > Karel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From giacomo at tesio.it Wed Apr 20 23:18:50 2016 From: giacomo at tesio.it (Giacomo Tesio) Date: Thu, 21 Apr 2016 01:18:50 +0200 Subject: [Haskell-cafe] Hugs In-Reply-To: <5717C1C0.2000201@ro-che.info> References: <5717C1C0.2000201@ro-che.info> Message-ID: 2016-04-20 19:52 GMT+02:00 Roman Cheplyaka : > On 04/20/2016 08:06 PM, Giacomo Tesio wrote: > > Is this a language issue? > > I don't think so... but apparently, despite the abundance of language > > hackers in the Haskell community, nobody still tried to prove that an > > interpreter for the core Haskell language can be written in a reasonable > > amount of C code. > > You are contradicting yourself. Mark P Jones and other "language > hackers" who contributed to Hugs have already proven that. > No contradiction, you are just misreading the statement: P. Jones proved that for Haskell98. For Haskell2010, it's still to be proved. > > That no-one seems to be willing to maintain Hugs may indicate that there > aren't as many use cases as you claim. > Maybe. But, as always in engineering, it's a matter of economics. > Thus, to my money (and admittedly for my own use cases), if somebody > > renew the interest around a simpler Haskell implementation, he's going > > to have a really *positive *effect. > > Would you put your money where your mouth is? I'm sure you would find > someone who could maintain and improve Hugs for you. > Sure, give me an estimate of the cost! I will seriously evaluate the investment. The requirements of the update are: - support Haskell2010 without any extension - simple and portable C code, possibly C99 but at least GCC - statically linked (possibly newlib, but I can replace the libc later) Actually to evaluate the RoI I need some statistics about the Hackage packages that such renewed Hugs would be able to run: - how many packages in Hackage are currently maintained? how many of them did exist 2 years ago? how many packages were maintained 2 years ago? - how many maintained packages conform to Haskell2010 without using any extension? - how many maintained packages use FFI (requiring libraries that should be linked with Hugs too)? - could such interpreter run cabal? Giacomo -------------- next part -------------- An HTML attachment was scrubbed... URL: From stegosaurus.armatus at gmail.com Thu Apr 21 00:27:10 2016 From: stegosaurus.armatus at gmail.com (Stegosaurus Armatus) Date: Wed, 20 Apr 2016 20:27:10 -0400 Subject: [Haskell-cafe] I've wanted a Haskell shirt for awhile Message-ID: Does anyone know where I can get one? Failing that, I made one to celebrate today. https://teespring.com/haskell-stay-lifted Disclaimer: I don't intend to be spammy, but I totally understand and respect if some people don't like this. I was just happy and wanted to share. Please don't hate. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Thu Apr 21 02:11:50 2016 From: david.feuer at gmail.com (David Feuer) Date: Wed, 20 Apr 2016 22:11:50 -0400 Subject: [Haskell-cafe] Generics changes in GHC 8 break containers In-Reply-To: References: Message-ID: containers does not currently build with GHC 8 because of changes to Generics. I only have a shallow understanding of GHC.Generics. Could someone give me a hand figuring out what I need to change? Thanks, David Feuer -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Thu Apr 21 04:13:36 2016 From: rustompmody at gmail.com (Rustom Mody) Date: Thu, 21 Apr 2016 09:43:36 +0530 Subject: [Haskell-cafe] Hugs In-Reply-To: References: Message-ID: On Wed, Apr 20, 2016 at 10:36 PM, Giacomo Tesio wrote: > PS: if somebody knows about a similar project please drop me a line > (Helium does not fit the requirements, as it depends on GHC itself). > > http://blog.languager.org/2014/09/pugofer.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From giacomo at tesio.it Thu Apr 21 10:19:32 2016 From: giacomo at tesio.it (Giacomo Tesio) Date: Thu, 21 Apr 2016 12:19:32 +0200 Subject: [Haskell-cafe] Documenting extensions In-Reply-To: <201604052012.u35KCFtx015545@coolidge.cs.Dartmouth.EDU> References: <201604052012.u35KCFtx015545@coolidge.cs.Dartmouth.EDU> Message-ID: 2016-04-05 22:12 GMT+02:00 Doug McIlroy : > Later I discovered > that by default GHC rejected almost all my report-conforming (H98 > and H2010) code. > Do you mean that GHC can't compile Haskell2010 conformant code? Can you please post (or point to) some examples? Giacomo -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Thu Apr 21 12:16:26 2016 From: hesselink at gmail.com (Erik Hesselink) Date: Thu, 21 Apr 2016 14:16:26 +0200 Subject: [Haskell-cafe] Documenting extensions In-Reply-To: References: <201604052012.u35KCFtx015545@coolidge.cs.Dartmouth.EDU> Message-ID: On 21 April 2016 at 12:19, Giacomo Tesio wrote: > 2016-04-05 22:12 GMT+02:00 Doug McIlroy : >> >> Later I discovered >> that by default GHC rejected almost all my report-conforming (H98 >> and H2010) code. > > > Do you mean that GHC can't compile Haskell2010 conformant code? > Can you please post (or point to) some examples? This page [1] lists the ways in which GHC diverges from the standard. Erik [1] https://downloads.haskell.org/~ghc/master/users-guide/bugs.html From doug at cs.dartmouth.edu Thu Apr 21 15:40:57 2016 From: doug at cs.dartmouth.edu (Doug McIlroy) Date: Thu, 21 Apr 2016 11:40:57 -0400 Subject: [Haskell-cafe] Documenting extensions Message-ID: <201604211540.u3LFevq6038254@tahoe.cs.Dartmouth.EDU> >>> Later I discovered >>> that by default GHC rejected almost all my report-conforming (H98 >>> and H2010) code. >> >> Do you mean that GHC can't compile Haskell2010 conformant code? >> Can you please post (or point to) some examples? > > This page [1] lists the ways in which GHC diverges from the standard. > > Erik > > [1] https://downloads.haskell.org/~ghc/master/users-guide/bugs.html The main problem was that my code relied on constraint (Num a) implying (Eq a) per the standard. I also had context clauses in data declarations. Thus I had to make pervasive, albeit trivial, changes to get past GHC's nonconformance. (Presumably option -XHaskell2010 would have papered over the trouble, but I prefer to maximize code portability.) Doug McIlroy From dorde.grbic at gmail.com Thu Apr 21 15:42:22 2016 From: dorde.grbic at gmail.com (=?UTF-8?B?xJBvcsSRZSBHcmJpxIc=?=) Date: Thu, 21 Apr 2016 17:42:22 +0200 Subject: [Haskell-cafe] ghc-mod errors in Emacs In-Reply-To: References: Message-ID: Greetings again, it seems that ghc-mod still refuses to cooperate. when I open a source file in Emacs, ghc (ghc-mod?) dumps: While parsing "/home/djordje/.stack/snapshots/x86_64-linux/lts-5.13/7.10.3/pkgdb/package.cache": demandInput: not enough bytes While parsing "/home/djordje/.stack/snapshots/x86_64-linux/lts-5.13/7.10.3/pkgdb/package.cache": demandInput: not enough bytes ghc-mod: While parsing "/home/djordje/.stack/snapshots/x86_64-linux/lts-5.13/7.10.3/pkgdb/package.cache": demandInput: not enough bytes I have ~/.local/bin/ and ~/.cabal/bin/ in my PATH. I don't know if this clashes or something. Also, I did stack new and stack setup when starting the project. Let me know I you need more info to fix the problem. Thank you, Djordje On 20 April 2016 at 19:46, ?or?e Grbi? wrote: > Hi guys, > Yes my .cabal file was a problem. > I've reinitialized the project with Stack and everything seems to be > working. > > Unfortunately, I've accidentally deleted the old .cabal file to show what > was wrong. > > Thanks a lot, > Djordje > > On 20 April 2016 at 10:48, Boris wrote: > >> Hey ?or?e, >> >> Do you use stack? If so, make sure that the project you are working on >> really uses `GHC 7.8.4`. >> >> P. S. Just shot in the air :-P >> >> ~ d12frosted >> >> On Wed, Apr 20, 2016 at 12:00 AM, ?or?e Grbi? >> wrote: >> >>> Greetings dear Haskell community, >>> >>> I'm trying to use Spacemacs for Haskell development >>> but as soon as I open a .hs file ghc-mod dumps errors: >>> >>> ghc-mod: : cannot satisfy -package-id >>> base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 >>> (use -v for more information) >>> : cannot satisfy -package-id >>> base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 >>> (use -v for more information) >>> : cannot satisfy -package-id >>> base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 >>> (use -v for more information) >>> >>> I have ghc-mod version: 5.5.0.0 compiled by GHC 7.8.4. >>> GHC version : 7.8.4 >>> Emacs: 24.5.1 >>> Spacemacs: 0.105.18 >>> OS: Ubuntu 14.04.4 LTS >>> >>> Any help is appreciated, >>> >>> Djordje Grbic >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From d12frosted at gmail.com Thu Apr 21 15:52:46 2016 From: d12frosted at gmail.com (Boris) Date: Thu, 21 Apr 2016 18:52:46 +0300 Subject: [Haskell-cafe] ghc-mod errors in Emacs In-Reply-To: References: Message-ID: Hey, It looks like you mix different versions of GHC. As you said before - `ghc-mod` is build with `GHC-7.8.4`. But in the quoted error I see `ghc-7.10.3`. You have to reinstall `ghc-mod` with GHC you are using in project. You can find more info here: https://github.com/syl20bnr/spacemacs/issues/5674#issuecomment-206440654 -------------- next part -------------- An HTML attachment was scrubbed... URL: From johnw at newartisans.com Thu Apr 21 19:43:49 2016 From: johnw at newartisans.com (John Wiegley) Date: Thu, 21 Apr 2016 12:43:49 -0700 Subject: [Haskell-cafe] ANN: New Haskell.org committee members Message-ID: The Haskell.org committee has selected its new member following the March self-nomination period. The new (returning) member is: * Gershom Bazerman Thank you to everyone who submitted a self-nomination. Note that if you have self-nominated in the past, but not been picked, please self-nominate again in the future. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 629 bytes Desc: not available URL: From dreixel at gmail.com Thu Apr 21 19:56:28 2016 From: dreixel at gmail.com (=?UTF-8?Q?Jos=C3=A9_Pedro_Magalh=C3=A3es?=) Date: Thu, 21 Apr 2016 20:56:28 +0100 Subject: [Haskell-cafe] Generics changes in GHC 8 break containers In-Reply-To: References: Message-ID: Hi David, Care to share exactly what breaks? What errors do you get? Cheers, Pedro On Thu, Apr 21, 2016 at 3:11 AM, David Feuer wrote: > containers does not currently build with GHC 8 because of changes to > Generics. I only have a shallow understanding of GHC.Generics. Could > someone give me a hand figuring out what I need to change? > > Thanks, > David Feuer > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Thu Apr 21 20:14:23 2016 From: david.feuer at gmail.com (David Feuer) Date: Thu, 21 Apr 2016 16:14:23 -0400 Subject: [Haskell-cafe] Generics changes in GHC 8 break containers In-Reply-To: References: Message-ID: See https://github.com/haskell/containers/issues/195 There's been some change to representation types. However, Andres L?h believes that the correct solution is to remove the Generic instances that were recently added to containers master (which have never appeared in a released version). I've opened a pull request to do so, but I'd prefer to hear from Wren Romano (co-maintainer) and Kubo Kov?? (who wrote the instances) before doing so. On Thu, Apr 21, 2016 at 3:56 PM, Jos? Pedro Magalh?es wrote: > Hi David, > > Care to share exactly what breaks? What errors do you get? > > > Cheers, > Pedro > > On Thu, Apr 21, 2016 at 3:11 AM, David Feuer wrote: >> >> containers does not currently build with GHC 8 because of changes to >> Generics. I only have a shallow understanding of GHC.Generics. Could someone >> give me a hand figuring out what I need to change? >> >> Thanks, >> David Feuer >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > From hjgtuyl at chello.nl Thu Apr 21 22:40:39 2016 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Fri, 22 Apr 2016 00:40:39 +0200 Subject: [Haskell-cafe] I've wanted a Haskell shirt for awhile In-Reply-To: References: Message-ID: On Thu, 21 Apr 2016 02:27:10 +0200, Stegosaurus Armatus wrote: > Does anyone know where I can get one? > > Failing that, I made one to celebrate today. > https://teespring.com/haskell-stay-lifted See https://wiki.haskell.org/Merchandise . You can add your shirt to this page. Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From wntuwntu at gmail.com Fri Apr 22 03:13:21 2016 From: wntuwntu at gmail.com (Eunsu Kim) Date: Thu, 21 Apr 2016 22:13:21 -0500 Subject: [Haskell-cafe] I have a question about Haskell Message-ID: <66E46C63-BC80-4895-B29C-3E5FB94654DC@gmail.com> Hi i have a problem in my code! here is my code: here is error message: in very bottom function (polyEvaluate), why is not working ?result <- map (\(a,b) -> a+b) powers? ??? in Prelude, it is working Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 2016-04-21 at 10.09.53 PM.png Type: image/png Size: 65233 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 2016-04-21 at 10.11.29 PM.png Type: image/png Size: 25586 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 2016-04-21 at 10.12.30 PM.png Type: image/png Size: 12203 bytes Desc: not available URL: From david.feuer at gmail.com Fri Apr 22 03:23:59 2016 From: david.feuer at gmail.com (David Feuer) Date: Thu, 21 Apr 2016 23:23:59 -0400 Subject: [Haskell-cafe] I have a question about Haskell In-Reply-To: <66E46C63-BC80-4895-B29C-3E5FB94654DC@gmail.com> References: <66E46C63-BC80-4895-B29C-3E5FB94654DC@gmail.com> Message-ID: Several people have posted about this homework problem on StackOverflow today, including one person whose name and code look very much like yours: http://stackoverflow.com/questions/36778193/to-evaluate-polynomial-in-haskell If that is indeed your question, I suggest you improve it by adding the missing code. In any case, sending screen captures of your code to haskell-cafe is not the best way to get help. Use plain text only, and send your question to haskell-beginners instead. On Thu, Apr 21, 2016 at 11:13 PM, Eunsu Kim wrote: > Hi > > i have a problem in my code! > > here is my code: > > here is error message: > > > in very bottom function (polyEvaluate), why is not working ?result <- map > (\(a,b) -> a+b) powers? ??? > > in Prelude, it is working > > > Thanks! > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 2016-04-21 at 10.12.30 PM.png Type: image/png Size: 12203 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 2016-04-21 at 10.09.53 PM.png Type: image/png Size: 65233 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 2016-04-21 at 10.11.29 PM.png Type: image/png Size: 25586 bytes Desc: not available URL: From breitner at kit.edu Fri Apr 22 10:55:15 2016 From: breitner at kit.edu (Joachim Breitner) Date: Fri, 22 Apr 2016 12:55:15 +0200 Subject: [Haskell-cafe] Haskell in Leipzig 2016: Call for Papers Message-ID: <1461322515.3807.10.camel@kit.edu> ?????????????????????????????Haskell in Leipzig ????????????????????????????September 14-15, 2016 ????????????????????????????HTKW Leipzig, Germany ?????????????????????????http://hal2016.haskell.org/ == About HaL == The workshop series ?Haskell in Leipzig?, now in its 11th year, brings together Haskell developers, Haskell researchers, Haskell enthusiasts and Haskell beginners to listen to talks, take part in tutorials, and join in interesting conversations. Everything related to Haskell is on topic, whether it is about current research, practical applications, interesting ideas off the beaten track, education, or art, and topics may extend to functional programming in general and its connections to other programming paradigms as well. This year, HaL is colocated with two related conferences, ?* the Workshop on Functional and (Constraint) Logic Programming (WFLP) and ?* the Workshop on (Constraint) Logic Programming (WLP), to form the Leipzig Week of Declarative Programming (L-DEC): ????http://nfa.imn.htwk-leipzig.de/LDEC2016/ In order to accommodate and welcome a more international audience, this year?s HaL will be held in English. == Submissions == Contributions can take the form of ?* talks (about 30 minutes), ?* tutorials (about 90 minutes), ?* demonstrations, artistic performances, or other extraordinary things. Please submit an abstract that describes the content and form of your presentation, the intended audience, and required previous knowledge. We recommend a length of 2 pages, so that the PC and the audience get a good idea of your submission, but this is not a hard requirement. You can submit your abstract, as an PDF document, at ???https://easychair.org/conferences/?conf=hal2016 until Friday, July 1, 2016. You will be notified by July 15, 2016. == Program committee == ?* Andreas Abel, Chalmers and Gothenburg University, Sweden ?* Heinrich Apfelmus, Leipzig, Germany ?* Joachim Breitner, Karlsruhe Institute of Technology, Germany (Chair) ?* Matthias Fischmann, Zerobuzz, Germany ?* Petra Hofstedt, BTU Cottbus-Senftenberg, Germany ?* Wolfgang Jeltsch, Institute of Cybernetics at Tallinn University of Technology, Estonia ?* Andres L?h, Well-Typed LLP, Germany ?* Alejandro Serrano Mena, Universiteit Utrecht, Netherlands ?* Neil Mitchell, Standard Chartered Bank, UK ?* Katie Ots, Facebook, UK ?* Peter Stadler, University of Leipzig, Germany ?* Henning Thielemann, Freelancer, Germany ?* Niki Vazou, University of California, San Diego, USA If you have any questions, please don?t hesitate to contact Joachim Breitner . -- Dipl.-Math. Dipl.-Inform. Joachim Breitner Wissenschaftlicher Mitarbeiter http://pp.ipd.kit.edu/~breitner -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From jake.waksbaum at gmail.com Fri Apr 22 14:23:12 2016 From: jake.waksbaum at gmail.com (Jake) Date: Fri, 22 Apr 2016 14:23:12 +0000 Subject: [Haskell-cafe] Automatically Deriving Numeric Type Class Instances Message-ID: Is it possible to automatically derive instances of Numeric type classes like Num, Fractional, Real, Floating, etc? I currently have two datatypes, Pair and Triple, that are defined like this: data Pair a = Pair a a data Triple a = Triple a a a I wrote these pretty trivial instances for Num and Floating: instance Num a => Num (Pair a) where (+) = liftA2 (+) (*) = liftA2 (*) abs = liftA abs negate = liftA negate signum = liftA signum fromInteger = pure . fromInteger instance Fractional a => Fractional (Pair a) where (/) = liftA2 (/) recip = liftA recip fromRational = pure . fromRational and practically identical instances for Triple as well. Is there anyway to have GHC derive these instances and the other numeric type classes? Thanks, Jake -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Fri Apr 22 19:14:00 2016 From: vogt.adam at gmail.com (adam vogt) Date: Fri, 22 Apr 2016 15:14:00 -0400 Subject: [Haskell-cafe] Automatically Deriving Numeric Type Class Instances In-Reply-To: References: Message-ID: Hi Jake https://hackage.haskell.org/package/applicative-numbers can generate those instances. Regards Adam On Apr 22, 2016 10:23 AM, "Jake" wrote: > Is it possible to automatically derive instances of Numeric type classes > like Num, Fractional, Real, Floating, etc? > > I currently have two datatypes, Pair and Triple, that are defined like > this: > > data Pair a = Pair a a > data Triple a = Triple a a a > > I wrote these pretty trivial instances for Num and Floating: > > instance Num a => Num (Pair a) where > (+) = liftA2 (+) > (*) = liftA2 (*) > abs = liftA abs > negate = liftA negate > signum = liftA signum > fromInteger = pure . fromInteger > > instance Fractional a => Fractional (Pair a) where > (/) = liftA2 (/) > recip = liftA recip > fromRational = pure . fromRational > > and practically identical instances for Triple as well. > > Is there anyway to have GHC derive these instances and the other numeric > type classes? > > Thanks, > Jake > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From monkleyon at googlemail.com Fri Apr 22 19:28:27 2016 From: monkleyon at googlemail.com (martin) Date: Fri, 22 Apr 2016 21:28:27 +0200 Subject: [Haskell-cafe] Documenting extensions In-Reply-To: <201604052012.u35KCFtx015545@coolidge.cs.Dartmouth.EDU> References: <201604052012.u35KCFtx015545@coolidge.cs.Dartmouth.EDU> Message-ID: <571A7B5B.9030008@gmail.com> On 2016-04-05 22:12, Doug McIlroy wrote: > > > The extensions section of the GHC User Guide gives no formal syntax, > often teaches semantics only by example, and is replete with sales > pitches, partial analogies, inconsistent terminology, and (helpful) > appeals to outside sources. Definitely not a bible. > > I understand that many GHC extensions are probationary. Nevertheless, > in the interest of facilitating their full and correct use, I would > plead that a report-grade description accompany each language feature > incorporated in official releases. I don't think the GHC User Guide is the best place to put this information. One reason is that GHC might be the most popular compiler by far, maybe even a "reference compiler" but it was never intended to be the only one. Thus language and compiler should be documented separately, if there is a nice way to do so. But maybe we get somewhere if we look at different challenges as well. For example: if you develop code for a project like Pandoc, you will most likely be developing on one version of GHC, but the final code will be checked against several other versions as well. How do you find out which extensions you can use in this subset of compilers? Do you develop on the oldest version of GHC that will be checked, keeping several versions on your machine? Or the oldest and the newest versions? All of them? Do you look up all the extensions of all the versions in the docs beforehand? Do you use whatever you want and then pull out extensions that didn't work? This latter challenge sparked a short-lived facebook discussion in a Haskell group some time ago. The result was mainly that there are easy ways to get a database of (Version,LanguageExtension) tuples (scraping the docs or asking nix-pkg, if nothing else). The next step might be to but this database on the web. It could work almost like caniuse.com works for browser compatibility, but for Haskell extensions. Starting from there, adding documentation to each extension and adding information about differences in implementation between versions should be as easy a editing a wiki. By the way: last time I checked "caniextend.com" did not seem to be registered. I honestly expected there to be a male-body-part-enlargement-website. Of course someone would have to build and maintain this thing. I don't expect there to be huge commercial value in it though, so motivations might not be high. That being said, I'm currently experimenting with Yesod in several projects. Once I get the hang of it and finished the most important ones I might attack this one just for kicks - if it's not already taken by then and if it doesn't turn out to be stupid. No promises though, which is why I didn't register the aforementioned URL. Feel free to take it if you have a student that keeps nagging you about giving him a project. Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From jake.waksbaum at gmail.com Fri Apr 22 19:39:47 2016 From: jake.waksbaum at gmail.com (Jake) Date: Fri, 22 Apr 2016 19:39:47 +0000 Subject: [Haskell-cafe] Automatically Deriving Numeric Type Class Instances In-Reply-To: References: Message-ID: Thanks Adam! My only concern is that this package appears to use the CPP to generate the instances which at least to me feels more hacky than the mechanism by which instances are usually derived, like for Show or Eq or other classes. I'd also be interested if someone could explain how those instances are derived if I could do something similar myself in this case. On Fri, Apr 22, 2016, 15:14 adam vogt wrote: > Hi Jake > > https://hackage.haskell.org/package/applicative-numbers can generate > those instances. > > Regards > Adam > On Apr 22, 2016 10:23 AM, "Jake" wrote: > >> Is it possible to automatically derive instances of Numeric type classes >> like Num, Fractional, Real, Floating, etc? >> >> I currently have two datatypes, Pair and Triple, that are defined like >> this: >> >> data Pair a = Pair a a >> data Triple a = Triple a a a >> >> I wrote these pretty trivial instances for Num and Floating: >> >> instance Num a => Num (Pair a) where >> (+) = liftA2 (+) >> (*) = liftA2 (*) >> abs = liftA abs >> negate = liftA negate >> signum = liftA signum >> fromInteger = pure . fromInteger >> >> instance Fractional a => Fractional (Pair a) where >> (/) = liftA2 (/) >> recip = liftA recip >> fromRational = pure . fromRational >> >> and practically identical instances for Triple as well. >> >> Is there anyway to have GHC derive these instances and the other numeric >> type classes? >> >> Thanks, >> Jake >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From ch.howard at zoho.com Sat Apr 23 05:28:45 2016 From: ch.howard at zoho.com (Christopher Howard) Date: Fri, 22 Apr 2016 21:28:45 -0800 Subject: [Haskell-cafe] Generators? Iterators? Message-ID: <571B080D.1040101@zoho.com> Hi. I'm more in the shallow end of the Haskell pool right now, so forgive me if this is really basic... In Haskell, what is the class for things that can provide an infinite sequence? I mean, things that produce a value as well as function for producing the next value? Clearly RandomGen does this, but what is the next level of abstraction above RandomGen (i.e., RandomGen minus the randomness aspect). -- http://justonemoremathproblem.com To protect my privacy, please use PGP encryption. It's free and easy to use! My public key ID is 0x340EA95A (pgp.mit.edu). From mle+hs at mega-nerd.com Sat Apr 23 05:47:38 2016 From: mle+hs at mega-nerd.com (Erik de Castro Lopo) Date: Sat, 23 Apr 2016 15:47:38 +1000 Subject: [Haskell-cafe] Generators? Iterators? In-Reply-To: <571B080D.1040101@zoho.com> References: <571B080D.1040101@zoho.com> Message-ID: <20160423154738.63a72e4f188b2dfec9cb1c30@mega-nerd.com> Christopher Howard wrote: > Hi. I'm more in the shallow end of the Haskell pool right now, so > forgive me if this is really basic... In Haskell, what is the class for > things that can provide an infinite sequence? People generally do this with lists and Haskell's lazy evaluation. For instance: let x = [1 .. ] produces the infinite list [1,2,3, .....]. Haskell's lazily evaluated lists allow for incredibly elegant solutions for some sorts of problems, like the spigot algorithm for generating (among other things) the digits of PI: http://www.cs.ox.ac.uk/people/jeremy.gibbons/publications/spigot.pdf Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ From alexanderaltman at me.com Sat Apr 23 06:30:00 2016 From: alexanderaltman at me.com (Alexander Altman) Date: Fri, 22 Apr 2016 23:30:00 -0700 Subject: [Haskell-cafe] Documenting extensions In-Reply-To: <571A7B5B.9030008@gmail.com> References: <201604052012.u35KCFtx015545@coolidge.cs.Dartmouth.EDU> <571A7B5B.9030008@gmail.com> Message-ID: <23575A91-9ABD-4B95-994E-87600B3058A0@me.com> This has already been done, although I'm sure it needs some work still: https://damianfral.github.io/ghcaniuse/ (Not my project, by the way.) > On Apr 22, 2016, at 12:28 PM, martin wrote: > >> On 2016-04-05 22:12, Doug McIlroy wrote: >> >> >> The extensions section of the GHC User Guide gives no formal syntax, >> often teaches semantics only by example, and is replete with sales >> pitches, partial analogies, inconsistent terminology, and (helpful) >> appeals to outside sources. Definitely not a bible. >> >> I understand that many GHC extensions are probationary. Nevertheless, >> in the interest of facilitating their full and correct use, I would >> plead that a report-grade description accompany each language feature >> incorporated in official releases. > I don't think the GHC User Guide is the best place to put this > information. One reason is that GHC might be the most popular compiler > by far, maybe even a "reference compiler" but it was never intended to > be the only one. Thus language and compiler should be documented > separately, if there is a nice way to do so. > > But maybe we get somewhere if we look at different challenges as well. > For example: if you develop code for a project like Pandoc, you will > most likely be developing on one version of GHC, but the final code will > be checked against several other versions as well. How do you find out > which extensions you can use in this subset of compilers? Do you develop > on the oldest version of GHC that will be checked, keeping several > versions on your machine? Or the oldest and the newest versions? All of > them? Do you look up all the extensions of all the versions in the docs > beforehand? Do you use whatever you want and then pull out extensions > that didn't work? > > This latter challenge sparked a short-lived facebook discussion in a > Haskell group some time ago. The result was mainly that there are easy > ways to get a database of (Version,LanguageExtension) tuples (scraping > the docs or asking nix-pkg, if nothing else). The next step might be to > but this database on the web. It could work almost like caniuse.com > works for browser compatibility, but for Haskell extensions. Starting > from there, adding documentation to each extension and adding > information about differences in implementation between versions should > be as easy a editing a wiki. > By the way: last time I checked "caniextend.com" did not seem to be > registered. I honestly expected there to be a > male-body-part-enlargement-website. > > Of course someone would have to build and maintain this thing. I don't > expect there to be huge commercial value in it though, so motivations > might not be high. That being said, I'm currently experimenting with > Yesod in several projects. Once I get the hang of it and finished the > most important ones I might attack this one just for kicks - if it's not > already taken by then and if it doesn't turn out to be stupid. > No promises though, which is why I didn't register the aforementioned > URL. Feel free to take it if you have a student that keeps nagging you > about giving him a project. > > Cheers, > Martin > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From michaelburge at pobox.com Sat Apr 23 06:36:52 2016 From: michaelburge at pobox.com (Michael Burge) Date: Fri, 22 Apr 2016 23:36:52 -0700 Subject: [Haskell-cafe] Generators? Iterators? In-Reply-To: <20160423154738.63a72e4f188b2dfec9cb1c30@mega-nerd.com> References: <571B080D.1040101@zoho.com> <20160423154738.63a72e4f188b2dfec9cb1c30@mega-nerd.com> Message-ID: There's Foldable for 'things that can be converted to lists', or Traversable for 'things that can be converted to lists underneath a Functor'. https://wiki.haskell.org/Foldable_and_Traversable On Fri, Apr 22, 2016 at 10:47 PM, Erik de Castro Lopo wrote: > Christopher Howard wrote: > > > Hi. I'm more in the shallow end of the Haskell pool right now, so > > forgive me if this is really basic... In Haskell, what is the class for > > things that can provide an infinite sequence? > > People generally do this with lists and Haskell's lazy evaluation. For > instance: > > let x = [1 .. ] > > produces the infinite list [1,2,3, .....]. > > Haskell's lazily evaluated lists allow for incredibly elegant solutions > for some sorts of problems, like the spigot algorithm for generating > (among other things) the digits of PI: > > http://www.cs.ox.ac.uk/people/jeremy.gibbons/publications/spigot.pdf > > Erik > -- > ---------------------------------------------------------------------- > Erik de Castro Lopo > http://www.mega-nerd.com/ > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jhenahan at me.com Sat Apr 23 06:07:29 2016 From: jhenahan at me.com (Jack Henahan) Date: Sat, 23 Apr 2016 02:07:29 -0400 Subject: [Haskell-cafe] Generators? Iterators? In-Reply-To: <571B080D.1040101@zoho.com> References: <571B080D.1040101@zoho.com> Message-ID: Types that admit a Monad instance can be used to represent such sequences (and more general ones besides). > On Apr 23, 2016, at 01:28, Christopher Howard wrote: > > Hi. I'm more in the shallow end of the Haskell pool right now, so > forgive me if this is really basic... In Haskell, what is the class for > things that can provide an infinite sequence? I mean, things that > produce a value as well as function for producing the next value? > Clearly RandomGen does this, but what is the next level of abstraction > above RandomGen (i.e., RandomGen minus the randomness aspect). > > -- > http://justonemoremathproblem.com > To protect my privacy, please use PGP encryption. It's free and easy > to use! My public key ID is 0x340EA95A (pgp.mit.edu). > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From jo at durchholz.org Sat Apr 23 07:22:51 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Sat, 23 Apr 2016 09:22:51 +0200 Subject: [Haskell-cafe] Generators? Iterators? In-Reply-To: <571B080D.1040101@zoho.com> References: <571B080D.1040101@zoho.com> Message-ID: <571B22CB.40309@durchholz.org> Am 23.04.2016 um 07:28 schrieb Christopher Howard: > I mean, things that > produce a value as well as function for producing the next value? In Haskell, the runtime decides when to evaluate things, so the compiler already compiles every single subexpression into code that can double as a generator. So... you have a list? The code that defines how everything after the first element should be constructed is already your generator. You have a tree? The code that defines the content of the child nodes is already your generator. You have an arbitrary recursively-defined data structure? The code that defines things "in the depth" is already a generator. You don't need to code generators. Also, you don't need to explicitly call them; you just pull up the values from the depth of the data structure, and the runtime will decide when to pull up a cached value or call the generator. Quite nifty, very flexible (because you never need to rearrange your code from function to generator or vice versa), somewhat hard to control. From defigueiredo at ucdavis.edu Sat Apr 23 04:28:43 2016 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Fri, 22 Apr 2016 22:28:43 -0600 Subject: [Haskell-cafe] Should webassembly be a target for GHC? Message-ID: <571AF9FB.9020803@ucdavis.edu> I'm interested in webassembly's recent momentum https://hacks.mozilla.org/2016/03/a-webassembly-milestone/ Is this a way we could get a foot in the web? I'm curious, just putting the thought out there. Cheers, Dimitri From jo at durchholz.org Sat Apr 23 08:52:35 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Sat, 23 Apr 2016 10:52:35 +0200 Subject: [Haskell-cafe] Should webassembly be a target for GHC? In-Reply-To: <571AF9FB.9020803@ucdavis.edu> References: <571AF9FB.9020803@ucdavis.edu> Message-ID: <571B37D3.7060302@durchholz.org> Am 23.04.2016 um 06:28 schrieb Dimitri DeFigueiredo: > I'm interested in webassembly's recent momentum > > https://hacks.mozilla.org/2016/03/a-webassembly-milestone/ > > Is this a way we could get a foot in the web? > I'm curious, just putting the thought out there. Points to consider: ITfind commented that he'd expect browser support to happen in around 3-5 years. My own comment would be the question whether it's going to happen at all, or peter out. Then there's the question whether Webassembly will be Haskell-friendly. It might be a good idea for some Haskell compiler expertise to participate in the interest group to make it so. Also, the purpose of WebAssembly will be to integrate with the browser's DOM and with Javascript library. These interfaces are inherently stateful, so whether that can succeed will massively depend on good Haskell library support. In particular, it will need to appeal to web developers, most of which will come from a Javascript background; that's quite a cultural gap that the Haskell-side library will have to bridge. I think the interface libraries will have to be designed by somebody who is at home and in love with both environments. Finally, any interface libraries that will have to be downloaded from web pages should be small. Less than 100k. Page bloat is a real and serious problem. Haskell could actually take off if it turns out that Haskell-generated Webassembly is smaller than Webassembly generated from other languages. Given that Haskell code tends to have a higher abstraction level than code written in other languages, that's quite possible; however, the entire compiler needs to be configured towards small footprint to achieve that goal, expect work required towards that end. Just tinkering with Webassembly won't make Haskell get a foot in the web, but it may provide valuable insights into how Haskell might interface with the Next Big Thing of That Kind, whatever that will be, so tinkering would be a project in its own right. If the goal is to get a foot in the web, that's going to require a lot of manpower, and the Haskell compiler crowd will have to contribute at least advice and problem analysis. Like you I'd like to see that happen but can't make much happen myself; the best I can do is to look how the journey might be, and hope somebody who can do actual work on that is will pick up what's useful about my thoughts. From alexander.kjeldaas at gmail.com Sat Apr 23 09:34:53 2016 From: alexander.kjeldaas at gmail.com (Alexander Kjeldaas) Date: Sat, 23 Apr 2016 11:34:53 +0200 Subject: [Haskell-cafe] Should webassembly be a target for GHC? In-Reply-To: <571B37D3.7060302@durchholz.org> References: <571AF9FB.9020803@ucdavis.edu> <571B37D3.7060302@durchholz.org> Message-ID: On Sat, Apr 23, 2016 at 10:52 AM, Joachim Durchholz wrote: > Finally, any interface libraries that will have to be downloaded from web > pages should be small. Less than 100k. Page bloat is a real and serious > problem. > > IMO, this particular thing is not a serious problem, and the web pages can easily handle two orders of magnitude larger web pages, 10MB javascript without problems (example: Google+). If part of the download is a standard library, then we'll see more use of cache forever semantics from standardized locations (CDNs). The stackage eco-system with pre-compiled packages can be directly mapped onto a cache forever system and with async download of new versions (like what Chrome and other browsers do today), the problem is mostly converted from a latency issue into a bandwidth issue, and we have plenty of bandwidth. Alexander -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.sorokin at gmail.com Sat Apr 23 09:43:13 2016 From: david.sorokin at gmail.com (David Sorokin) Date: Sat, 23 Apr 2016 12:43:13 +0300 Subject: [Haskell-cafe] [ANN] Aivika: A parallel distributed discrete event simulation library Message-ID: <6EF4B30A-EF30-426D-A277-00550C4F74B6@gmail.com> Hi Cafe! I?m glad to announce the first add-on module [3] of Aivika simulation library that allows creating and running parallel distributed discrete event simulations. It is destined for clusters and supercomputers, although it works on a stand-alone notebook too. My module implements an optimistic strategy that implies transparent rollbacks. It is mainly inspired by ideas of the Time Warp algorithm, which first publication is dated early 80s. Please note that this is the first version. It is mainly experimental, but it already shows good results. For example, when using the reproducible random number generators on different nodes, I always get the same simulation results. Furthermore, for testing purposes, I rewrote one of my examples with discrete processes and the shared resource so that it uses too much messages just to see how it works. The add-on module allows doing everything that the generalized version [2] of Aivika can do in a part related to the discrete event simulation. Moreover, the parallel nodes can communicate to each other sending and receiving asynchronous messages, but these messages have the send and receive times. If the node receives the past message, a transparent rollback occurs so that the node can process the received message. When rolling the computation back, the node sends so called anti-messages to cancel the invalidated messages that came from the node. It allows us to have a predictable distributed simulation satisfying the time constraints and causality. There are different customization parameters that allow tuning the library. For example, by default the library waits 5 seconds to consider the local time of the node defined. Therefore, when running test models, you can see a small delay, which is necessary for finishing the synchronization between the nodes and so called time server. Unfortunately, there is a lack of documentation. But the main idea is as follows. The generalized version [2] is almost the same as the core library [1] which already has a documentation. The represented add-on [3] just allows using the generalized version for creating and running parallel distributed discrete event simulations within the specified computation. Best regards, David Sorokin, Yoshkar-Ola, Russia [1] http://hackage.haskell.org/package/aivika [2] http://hackage.haskell.org/package/aivika-transformers [3] http://hackage.haskell.org/package/aivika-distributed From jo at durchholz.org Sat Apr 23 10:08:01 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Sat, 23 Apr 2016 12:08:01 +0200 Subject: [Haskell-cafe] Should webassembly be a target for GHC? In-Reply-To: References: <571AF9FB.9020803@ucdavis.edu> <571B37D3.7060302@durchholz.org> Message-ID: <571B4981.5020709@durchholz.org> Am 23.04.2016 um 11:34 schrieb Alexander Kjeldaas: > On Sat, Apr 23, 2016 at 10:52 AM, Joachim Durchholz > wrote: > > >> Finally, any interface libraries that will have to be downloaded from web >> pages should be small. Less than 100k. Page bloat is a real and serious >> problem. >> >> > IMO, this particular thing is not a serious problem, and the web pages can > easily handle two orders of magnitude larger web pages, 10MB javascript > without problems (example: Google+). Well, that's far too much. You have people on UMTS, you have people in countries with low wired network bandwidth, and these are all locked out if every single page needs a download of 10 MB. BTW the average web page size is about the same as the Doom install image: https://mobiforge.com/research-analysis/the-web-is-doom That's just ridiculous. > If part of the download is a > standard library, then we'll see more use of cache forever semantics from > standardized locations (CDNs). Cache-forever does not happen in practice. Stuff gets upgraded, stuff gets evicted from caches. Particularly if you're entering at the bottom of the Alexa rankings, you can't rely on that to fix the problems for you. > The stackage eco-system with pre-compiled > packages can be directly mapped onto a cache forever system and with async > download of new versions (like what Chrome and other browsers do today), > the problem is mostly converted from a latency issue into a bandwidth > issue, and we have plenty of bandwidth. You have. I have. Our users do not have. Also, large libraries tend to be slow - it's not a 1:1 correlation, but it is statistically significant. So if you try to keep code size under control, that's usually a net win. BTW there's also a latency issue: Larger libraries tend to load slower, particularly if the user's persistent storage isn't an SSD but spinning-rust technology. 10 MB is latency even if it's not being downloaded. The prevalence of reactions like yours is what has been making web slowness part of the problem. 10 years ago, I could open dozens of web pages in my browser, and things would be snappy; today, with a machine that's ten times as powerful, the browser gets bogged down at a mere dozen webpages open in tabs. This isn't going to become better, Webassembly or not. Regards, Jo From imantc at gmail.com Sat Apr 23 10:22:08 2016 From: imantc at gmail.com (Imants Cekusins) Date: Sat, 23 Apr 2016 12:22:08 +0200 Subject: [Haskell-cafe] Should webassembly be a target for GHC? In-Reply-To: <571B4981.5020709@durchholz.org> References: <571AF9FB.9020803@ucdavis.edu> <571B37D3.7060302@durchholz.org> <571B4981.5020709@durchholz.org> Message-ID: > the browser gets bogged down at a mere dozen webpages open in tabs. I just opened 20 random pages of wiki as tabs in one browser window. ?There was no delay opening these pages or paging / scrolling any of them. Yes there are websites which consume many resources. I suppose visitors to these websites are ok with this, or maintainers of these websites are ok with visitor activity as it is. -------------- next part -------------- An HTML attachment was scrubbed... URL: From t_gass at gmx.de Sat Apr 23 12:08:38 2016 From: t_gass at gmx.de (Tilmann) Date: Sat, 23 Apr 2016 14:08:38 +0200 Subject: [Haskell-cafe] wxhaskell: Play sound not working on OSX? Message-ID: <571B65C6.60701@gmx.de> Is it possible that play . sound might not work on OSX or I'm I doing something wrong? This advice from around 2006 is all I could find: "Did you build wxWidgets with configuring --enable-sound build option?" Is this still valid? If so, how do I do that? Tilmann |import Graphics.UI.WX main :: IO () main = start $ do f <- frame [] p <- panel f [] set f [layout := minsize(Size 100 100) $ widget p] play (sound "alarm.wav") | Using OSX 10.9.5, GHC 7.10.2, WX 0.92.2.0 http://stackoverflow.com/questions/36809989/play-sound-with-wxhaskell-not-working-on-osx -------------- next part -------------- An HTML attachment was scrubbed... URL: From _deepfire at feelingofgreen.ru Sat Apr 23 12:17:00 2016 From: _deepfire at feelingofgreen.ru (Kosyrev Serge) Date: Sat, 23 Apr 2016 15:17:00 +0300 Subject: [Haskell-cafe] Should webassembly be a target for GHC? In-Reply-To: <571B4981.5020709@durchholz.org> (sfid-20160423_143822_211876_CA719561) (Joachim Durchholz's message of "Sat, 23 Apr 2016 12:08:01 +0200") References: <571AF9FB.9020803@ucdavis.edu> <571B37D3.7060302@durchholz.org> <571B4981.5020709@durchholz.org> Message-ID: <87fuuccyf7.fsf@andromedae.feelingofgreen.ru> Joachim Durchholz writes: >> IMO, this particular thing is not a serious problem, and the web pages can >> easily handle two orders of magnitude larger web pages, 10MB javascript >> without problems (example: Google+). > > Well, that's far too much. You have people on UMTS, you have people in countries > with low wired network bandwidth, and these are all locked out if every single > page needs a download of 10 MB. > > BTW the average web page size is about the same as the Doom install image: > https://mobiforge.com/research-analysis/the-web-is-doom > That's just ridiculous. This almost sounds like an attempt to assign morality to program size. It doesn't seem evident that there is any notion of morality in how we, collectively, as humanity, seem to reach for tools of expression -- indeed, it trumps morality. Personal preferences aside, every time that someone finds out a way to be perceivable more expressive, you can count on that an X% increase in size will be gladly, indeed gleefully, accepted. This is outside of our control. All we can do is offer a tool, among many others. > The prevalence of reactions like yours is what has been making web slowness part > of the problem. 10 years ago, I could open dozens of web pages in my browser, and > things would be snappy; today, with a machine that's ten times as powerful, the > browser gets bogged down at a mere dozen webpages open in tabs. > This isn't going to become better, Webassembly or not. ... -- ? ???????e? / respectfully, ??????? ?????? From julian at getcontented.com.au Sat Apr 23 12:36:04 2016 From: julian at getcontented.com.au (Julian Leviston) Date: Sat, 23 Apr 2016 22:36:04 +1000 Subject: [Haskell-cafe] Haskell-Cafe Digest, Vol 152, Issue 27 In-Reply-To: References: Message-ID: <9E9444FA-C188-444E-A4D2-9DADAA04F5B4@getcontented.com.au> There were quite a few responses to you so far, but no one seemed to mention that what you actually asked for are called anamorphisms. https://en.wikipedia.org/wiki/Anamorphism They?re not a *class* per se (as in? they?re not a typeclass), but rather they?re a kind of higher-order function which we call unfold (the kind-of ?opposite" action to a fold). Here?s a nice little thing I found which is quite helpful as an explanation: https://gist.github.com/CMCDragonkai/b586ee9ecce297ceeeb3 and Data.List has unfoldr: http://hackage.haskell.org/package/base-4.8.2.0/docs/Data-List.html#v:unfoldr If you google around for either "anamorphism Haskell? or ?unfold Haskell? you?ll find some nice explanatory resources. Hope that helps! Julian http://www.happylearnjavascripttutorial.com/ - begin programming with JavaScript today using our awesome new method! http://www.happylearnhaskelltutorial.com/ - begin programming with Haskell today using our awesome new method! > On 23 Apr 2016, at 10:00 PM, haskell-cafe-request at haskell.org wrote: > > Hi. I'm more in the shallow end of the Haskell pool right now, so > forgive me if this is really basic... In Haskell, what is the class for > things that can provide an infinite sequence? I mean, things that > produce a value as well as function for producing the next value? > Clearly RandomGen does this, but what is the next level of abstraction > above RandomGen (i.e., RandomGen minus the randomness aspect). -------------- next part -------------- An HTML attachment was scrubbed... URL: From bergey at teallabs.org Sat Apr 23 17:45:27 2016 From: bergey at teallabs.org (Daniel Bergey) Date: Sat, 23 Apr 2016 13:45:27 -0400 Subject: [Haskell-cafe] Should webassembly be a target for GHC? In-Reply-To: <571AF9FB.9020803@ucdavis.edu> References: <571AF9FB.9020803@ucdavis.edu> Message-ID: <87ziskrzgo.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> On 2016-04-23 at 00:28, Dimitri DeFigueiredo wrote: > I'm interested in webassembly's recent momentum > > https://hacks.mozilla.org/2016/03/a-webassembly-milestone/ > > Is this a way we could get a foot in the web? > I'm curious, just putting the thought out there. GHCJS can compile Haskell to JS already - anything that GHC compiles, except libraries that link against non-Haskell code. There are also various Haskell-like languages, with which I'm less familiar. Periodically someone asks about generating webassembly or asm.js from GHCJS. For example: https://github.com/ghcjs/ghcjs/issues/53 https://github.com/ghcjs/ghcjs/issues/359 My understanding is GHCJS depends on first-class functions and garbage collection in the JS runtime, which aren't provided by the assembly subset. bergey From conal at conal.net Sat Apr 23 22:20:44 2016 From: conal at conal.net (Conal Elliott) Date: Sat, 23 Apr 2016 15:20:44 -0700 Subject: [Haskell-cafe] Automatically Deriving Numeric Type Class Instances In-Reply-To: References: Message-ID: Hi Jake. I wrote applicative-numbers. The key observation is that every applicative functor gives rise to instances of Num & friends in a standard way, as you've noticed. Since your examples are isomorphic to functions from a suitably chosen domain, and function-from-t is an applicative functor for all types t, your examples are also applicative functors, with instances you can derive (as in http://conal.net/papers/type-class-morphisms/). It might make for a simple and useful project to convert applicative-numbers to use Template Haskell. - Conal On Fri, Apr 22, 2016 at 12:39 PM, Jake wrote: > Thanks Adam! My only concern is that this package appears to use the CPP > to generate the instances which at least to me feels more hacky than the > mechanism by which instances are usually derived, like for Show or Eq or > other classes. > > I'd also be interested if someone could explain how those instances are > derived if I could do something similar myself in this case. > > On Fri, Apr 22, 2016, 15:14 adam vogt wrote: > >> Hi Jake >> >> https://hackage.haskell.org/package/applicative-numbers can generate >> those instances. >> >> Regards >> Adam >> On Apr 22, 2016 10:23 AM, "Jake" wrote: >> >>> Is it possible to automatically derive instances of Numeric type classes >>> like Num, Fractional, Real, Floating, etc? >>> >>> I currently have two datatypes, Pair and Triple, that are defined like >>> this: >>> >>> data Pair a = Pair a a >>> data Triple a = Triple a a a >>> >>> I wrote these pretty trivial instances for Num and Floating: >>> >>> instance Num a => Num (Pair a) where >>> (+) = liftA2 (+) >>> (*) = liftA2 (*) >>> abs = liftA abs >>> negate = liftA negate >>> signum = liftA signum >>> fromInteger = pure . fromInteger >>> >>> instance Fractional a => Fractional (Pair a) where >>> (/) = liftA2 (/) >>> recip = liftA recip >>> fromRational = pure . fromRational >>> >>> and practically identical instances for Triple as well. >>> >>> Is there anyway to have GHC derive these instances and the other numeric >>> type classes? >>> >>> Thanks, >>> Jake >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ascottiii at gmail.com Sun Apr 24 17:18:35 2016 From: ascottiii at gmail.com (Art Scott) Date: Sun, 24 Apr 2016 17:18:35 +0000 (UTC) Subject: [Haskell-cafe] Q- Should webassembly be a target for GHC? A - Yes ... References: <571AF9FB.9020803@ucdavis.edu> Message-ID: Dimitri DeFigueiredo ucdavis.edu> writes: > > I'm interested in webassembly's recent momentum > > https://hacks.mozilla.org/2016/03/a-webassembly-milestone/ > > Is this a way we could get a foot in the web? > I'm curious, just putting the thought out there. > > Cheers, > > Dimitri > http://venturebeat.com/2016/03/16/mozilla-will-release-the-first-tech- demo-of-servo-its-next-generation-browser-engine-in-june/ From bogus@does.not.exist.com Sun Apr 24 20:07:37 2016 From: bogus@does.not.exist.com () Date: Sun, 24 Apr 2016 20:07:37 -0000 Subject: [Haskell-cafe] (no subject) Message-ID: >From int-e at gmx.de Sun Apr 24 21:13:18 2016 Date: Sun, 24 Apr 2016 21:13:18 +0200 From: Bertram Felgenhauer To: haskell-cafe at haskell.org Subject: Re: [Haskell-cafe] Is it possible to make lazy combinators for IO? Message-ID: <20160424191319.GA32509 at 24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Status: RO Content-Length: 1283 Lines: 37 David Feuer wrote: > What I'm looking for is more limited than lazy IO or unsafeInterleaveIO, > but it seems quite possible that there's no way to get just what I'm > looking for with the IO type proper using GHC's implementation of IO. Lazy > IO allows evaluation to drive action. When a thunk is forced, it may > trigger I/O (spooky action at a distance). What I'm talking about is > separating what actions are performed from what values are calculated from > them. Here's a partial concept which won't actually compile because of the > lazy pattern matches: > > data MyIO a = forall b . MyIO (b -> a) (IO b) > instance Functor MyIO where > fmap f ~(MyIO t m) = MyIO (f . t) m > instance Applicative MyIO where > pure a = MyIO (const a) (pure ()) > MyIO t1 m1 <*> ~(MyIO t2 m2) = > MyIO (\(r1, r2) -> t1 r1 (t2 r2)) ((,) <$> m1 <*> m2) > instance Monad MyIO where > ??? > instance MonadFix MyIO where > ??? I believe that using this interface `unsafeInterleaveIO` could be implemented as follows, making it just as powerful as lazy IO: data Box a = Box a unsafeInterleaveMyIO :: MyIO a -> MyIO a unsafeInterleaveMyIO act = do act' <- Box `fmap` act return $ case act' of Box !r -> r Have I missed anything? Cheers, Bertram From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Apr 24 21:08:00 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 24 Apr 2016 22:08:00 +0100 Subject: [Haskell-cafe] (no subject) In-Reply-To: <20160424200740.AC81DBCF64@haskell.org> References: <20160424200740.AC81DBCF64@haskell.org> Message-ID: <20160424210759.GA9708@weber> On Sun, Apr 24, 2016 at 08:07:40PM +0000, haskell-cafe-bounces at haskell.org wrote: > >From int-e at gmx.de Sun Apr 24 21:13:18 2016 > Date: Sun, 24 Apr 2016 21:13:18 +0200 > From: Bertram Felgenhauer > To: haskell-cafe at haskell.org > Subject: Re: [Haskell-cafe] Is it possible to make lazy combinators for IO? > Message-ID: <20160424191319.GA32509 at 24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> > References: > > > > > > > > MIME-Version: 1.0 > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > In-Reply-To: > User-Agent: Mutt/1.5.24 (2015-08-30) > Status: RO > Content-Length: 1283 > Lines: 37 > > David Feuer wrote: > > What I'm looking for is more limited than lazy IO or unsafeInterleaveIO, > > but it seems quite possible that there's no way to get just what I'm > > looking for with the IO type proper using GHC's implementation of IO. Lazy > > IO allows evaluation to drive action. When a thunk is forced, it may > > trigger I/O (spooky action at a distance). What I'm talking about is > > separating what actions are performed from what values are calculated from > > them. Here's a partial concept which won't actually compile because of the > > lazy pattern matches: > > > > data MyIO a = forall b . MyIO (b -> a) (IO b) > > instance Functor MyIO where > > fmap f ~(MyIO t m) = MyIO (f . t) m > > instance Applicative MyIO where > > pure a = MyIO (const a) (pure ()) > > MyIO t1 m1 <*> ~(MyIO t2 m2) = > > MyIO (\(r1, r2) -> t1 r1 (t2 r2)) ((,) <$> m1 <*> m2) > > instance Monad MyIO where > > ??? > > instance MonadFix MyIO where > > ??? > > I believe that using this interface `unsafeInterleaveIO` could be > implemented as follows, making it just as powerful as lazy IO: > > data Box a = Box a > > unsafeInterleaveMyIO :: MyIO a -> MyIO a > unsafeInterleaveMyIO act = do > act' <- Box `fmap` act > return $ case act' of Box !r -> r > > Have I missed anything? Since MyIO and its associate functions don't contain any unsafe primitives it seems highly unlikely you can implement unsafeInterleaveIO with them! In fact I can't see how MyIO is any different to IO. All you can do with the function field is fmap it over the IO action field. Tom From bertram.felgenhauer at googlemail.com Sun Apr 24 21:20:24 2016 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Sun, 24 Apr 2016 23:20:24 +0200 Subject: [Haskell-cafe] (no subject) In-Reply-To: <20160424210759.GA9708@weber> References: <20160424200740.AC81DBCF64@haskell.org> <20160424210759.GA9708@weber> Message-ID: <20160424212024.GA2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> First off, sorry for the botched email earlier; I should know better than to send an emails manually. (long story...) Tom Ellis wrote: > On Sun, Apr 24, 2016 at 08:07:40PM +0000, haskell-cafe-bounces at haskell.org wrote: [snip] > > David Feuer wrote: > > > What I'm looking for is more limited than lazy IO or unsafeInterleaveIO, > > > but it seems quite possible that there's no way to get just what I'm > > > looking for with the IO type proper using GHC's implementation of IO. Lazy > > > IO allows evaluation to drive action. When a thunk is forced, it may > > > trigger I/O (spooky action at a distance). What I'm talking about is > > > separating what actions are performed from what values are calculated from > > > them. Here's a partial concept which won't actually compile because of the > > > lazy pattern matches: > > > > > > data MyIO a = forall b . MyIO (b -> a) (IO b) > > > instance Functor MyIO where > > > fmap f ~(MyIO t m) = MyIO (f . t) m > > > instance Applicative MyIO where > > > pure a = MyIO (const a) (pure ()) > > > MyIO t1 m1 <*> ~(MyIO t2 m2) = > > > MyIO (\(r1, r2) -> t1 r1 (t2 r2)) ((,) <$> m1 <*> m2) > > > instance Monad MyIO where > > > ??? > > > instance MonadFix MyIO where > > > ??? > > > > I believe that using this interface `unsafeInterleaveIO` could be > > implemented as follows, making it just as powerful as lazy IO: > > > > data Box a = Box a > > > > unsafeInterleaveMyIO :: MyIO a -> MyIO a > > unsafeInterleaveMyIO act = do > > act' <- Box `fmap` act > > return $ case act' of Box !r -> r > > > > Have I missed anything? > > Since MyIO and its associate functions don't contain any unsafe primitives > it seems highly unlikely you can implement unsafeInterleaveIO with them! > > In fact I can't see how MyIO is any different to IO. All you can do with > the function field is fmap it over the IO action field. Note that the code for the Monad instance is missing. The desired semantics as I understood them were that in `x >>= y`, `y` could access the "data part" that is produced by the embedded function (first component of MyIO) of `x` before the IO action associated with `x` was performed; the IO action would be triggered when that function forces its argument. This "early access" to the data part would then allow `mfix` to be lazier than it currently is. The point I'm trying to make is that these are exactly the semantics that `unsafeInterleaveIO` provides, and to my mind this is best demonstrated by implementing that function in the MyIO interface. Cheers, Bertram From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sun Apr 24 21:28:35 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sun, 24 Apr 2016 22:28:35 +0100 Subject: [Haskell-cafe] (no subject) In-Reply-To: <20160424212024.GA2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <20160424200740.AC81DBCF64@haskell.org> <20160424210759.GA9708@weber> <20160424212024.GA2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: <20160424212835.GB9708@weber> On Sun, Apr 24, 2016 at 11:20:24PM +0200, Bertram Felgenhauer wrote: > Tom Ellis wrote: > > On Sun, Apr 24, 2016 at 08:07:40PM +0000, haskell-cafe-bounces at haskell.org wrote: > [snip] > > > David Feuer wrote: > > > > What I'm looking for is more limited than lazy IO or unsafeInterleaveIO, > > > > but it seems quite possible that there's no way to get just what I'm > > > > looking for with the IO type proper using GHC's implementation of IO. Lazy > > > > IO allows evaluation to drive action. When a thunk is forced, it may > > > > trigger I/O (spooky action at a distance). What I'm talking about is > > > > separating what actions are performed from what values are calculated from > > > > them. Here's a partial concept which won't actually compile because of the > > > > lazy pattern matches: > > > > > > > > data MyIO a = forall b . MyIO (b -> a) (IO b) > > > > instance Functor MyIO where > > > > fmap f ~(MyIO t m) = MyIO (f . t) m > > > > instance Applicative MyIO where > > > > pure a = MyIO (const a) (pure ()) > > > > MyIO t1 m1 <*> ~(MyIO t2 m2) = > > > > MyIO (\(r1, r2) -> t1 r1 (t2 r2)) ((,) <$> m1 <*> m2) > > > > instance Monad MyIO where > > > > ??? > > > > instance MonadFix MyIO where > > > > ??? > > > > > > I believe that using this interface `unsafeInterleaveIO` could be > > > implemented as follows, making it just as powerful as lazy IO: > > > > > > data Box a = Box a > > > > > > unsafeInterleaveMyIO :: MyIO a -> MyIO a > > > unsafeInterleaveMyIO act = do > > > act' <- Box `fmap` act > > > return $ case act' of Box !r -> r > > > > > > Have I missed anything? > > > > Since MyIO and its associate functions don't contain any unsafe primitives > > it seems highly unlikely you can implement unsafeInterleaveIO with them! > > > > In fact I can't see how MyIO is any different to IO. All you can do with > > the function field is fmap it over the IO action field. > > Note that the code for the Monad instance is missing. The desired > semantics as I understood them were that in `x >>= y`, `y` could access > the "data part" that is produced by the embedded function (first > component of MyIO) of `x` before the IO action associated with `x` > was performed; the IO action would be triggered when that function > forces its argument. This "early access" to the data part would then > allow `mfix` to be lazier than it currently is. I see. Well there is no benefit in splitting MyIO up into two parts. It will suffice to do data MyIO a = MyIO (IO a) Then perhaps you want something like instance Monad MyIO where return = MyIO . return ~(MyIO m) >>= ~(MyIO f) = MyIO (unsafeInterleaveIO m >>= f) > The point I'm trying to make is that these are exactly the semantics > that `unsafeInterleaveIO` provides, and to my mind this is best > demonstrated by implementing that function in the MyIO interface. So your idea is that unsafeInterleaveIO can be captured as a monad? Interesting. Tom From bertram.felgenhauer at googlemail.com Sun Apr 24 22:08:28 2016 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Mon, 25 Apr 2016 00:08:28 +0200 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? (Was: (no subject)) In-Reply-To: <20160424212024.GA2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <20160424200740.AC81DBCF64@haskell.org> <20160424210759.GA9708@weber> <20160424212024.GA2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: <20160424220828.GB2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Bertram Felgenhauer wrote: > Tom Ellis wrote: > > On Sun, Apr 24, 2016 at 08:07:40PM +0000, haskell-cafe-bounces at haskell.org wrote: > > > David Feuer wrote: > > > > What I'm looking for is more limited than lazy IO or unsafeInterleaveIO, > > > > but it seems quite possible that there's no way to get just what I'm > > > > looking for with the IO type proper using GHC's implementation of IO. Lazy > > > > IO allows evaluation to drive action. When a thunk is forced, it may > > > > trigger I/O (spooky action at a distance). What I'm talking about is > > > > separating what actions are performed from what values are calculated from > > > > them. Here's a partial concept which won't actually compile because of the > > > > lazy pattern matches: > > > > > > > > data MyIO a = forall b . MyIO (b -> a) (IO b) > > > > instance Functor MyIO where > > > > fmap f ~(MyIO t m) = MyIO (f . t) m > > > > instance Applicative MyIO where > > > > pure a = MyIO (const a) (pure ()) > > > > MyIO t1 m1 <*> ~(MyIO t2 m2) = > > > > MyIO (\(r1, r2) -> t1 r1 (t2 r2)) ((,) <$> m1 <*> m2) > > > > instance Monad MyIO where > > > > ??? > > > > instance MonadFix MyIO where > > > > ??? > > > > > > I believe that using this interface `unsafeInterleaveIO` could be > > > implemented as follows, making it just as powerful as lazy IO: > > > > > > data Box a = Box a > > > > > > unsafeInterleaveMyIO :: MyIO a -> MyIO a > > > unsafeInterleaveMyIO act = do > > > act' <- Box `fmap` act > > > return $ case act' of Box !r -> r > > > > > > Have I missed anything? > > > > Since MyIO and its associate functions don't contain any unsafe primitives > > it seems highly unlikely you can implement unsafeInterleaveIO with them! > > > > In fact I can't see how MyIO is any different to IO. All you can do with > > the function field is fmap it over the IO action field. > > Note that the code for the Monad instance is missing. The desired > semantics as I understood them were that in `x >>= y`, `y` could access > the "data part" that is produced by the embedded function (first > component of MyIO) of `x` before the IO action associated with `x` > was performed; the IO action would be triggered when that function > forces its argument. This "early access" to the data part would then > allow `mfix` to be lazier than it currently is. I see what I missed here: The IO part of `y` should also force the IO part of `x` to be performed, and that is not captured by `unsafeInterleaveIO`, since it preserves the order of the IO actions. In fact such a monad already exists in the form of the lazy ST monad. So... import Control.Monad.ST.Lazy as LST import Control.Monad.ST.Lazy.Unsafe as LSTU import Control.Monad.IO.Class import Control.Monad.Fix newtype MyIO a = MyIO (LST.ST RealWorld a) deriving (Functor, Applicative, Monad, MonadFix) instance MonadIO MyIO where liftIO = MyIO . LSTU.unsafeIOToST runMyIO :: MyIO a -> IO a runMyIO (MyIO f) = stToIO f main = runMyIO $ do l <- (2:) `fmap` liftIO readLn m <- replicateM (head l) (liftIO readLn) liftIO (print (l :: [Int],m :: [Int])) Cheers, Bertram From david.feuer at gmail.com Mon Apr 25 00:16:28 2016 From: david.feuer at gmail.com (David Feuer) Date: Sun, 24 Apr 2016 20:16:28 -0400 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? (Was: (no subject)) In-Reply-To: <20160424220828.GB2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <20160424200740.AC81DBCF64@haskell.org> <20160424210759.GA9708@weber> <20160424212024.GA2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> <20160424220828.GB2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: Spectacular! That looks like just what I wanted! Unless there are some hidden gotchas, it might be worth making a package of that. The bit that's strangest to me is how stToIO (seems to) make sure that all the actions actually get performed. David On Sun, Apr 24, 2016 at 6:08 PM, Bertram Felgenhauer wrote: > I see what I missed here: The IO part of `y` should also force the IO part > of `x` to be performed, and that is not captured by `unsafeInterleaveIO`, > since it preserves the order of the IO actions. In fact such a monad > already exists in the form of the lazy ST monad. So... > > import Control.Monad.ST.Lazy as LST > import Control.Monad.ST.Lazy.Unsafe as LSTU > import Control.Monad.IO.Class > import Control.Monad.Fix > > newtype MyIO a = MyIO (LST.ST RealWorld a) > deriving (Functor, Applicative, Monad, MonadFix) > > instance MonadIO MyIO where > liftIO = MyIO . LSTU.unsafeIOToST > > runMyIO :: MyIO a -> IO a > runMyIO (MyIO f) = stToIO f > > main = runMyIO $ do > l <- (2:) `fmap` liftIO readLn > m <- replicateM (head l) (liftIO readLn) > liftIO (print (l :: [Int],m :: [Int])) > > Cheers, > > Bertram From david.feuer at gmail.com Mon Apr 25 04:38:54 2016 From: david.feuer at gmail.com (David Feuer) Date: Mon, 25 Apr 2016 00:38:54 -0400 Subject: [Haskell-cafe] Dropping support for NHC98 and old GHC from containers Message-ID: The containers package currently includes CPP and Cabal directives intended to support NHC98 and versions of GHC before 7.0. However, our TravisCI script tests only GHC versions 7.0 and above. It is therefore likely that the compatibility code is bit-rotted to some extent. Wren Romano and I are strongly inclined to immediately remove all code intended to support NHC98 or pre-7.0 GHC. If anyone uses any such implementations with the current version of containers, please speak now or forever hold your peace. Thanks, David Feuer From carter.schonwald at gmail.com Mon Apr 25 12:22:42 2016 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Mon, 25 Apr 2016 08:22:42 -0400 Subject: [Haskell-cafe] Dropping support for NHC98 and old GHC from containers In-Reply-To: References: Message-ID: Do it! :) On Monday, April 25, 2016, David Feuer wrote: > The containers package currently includes CPP and Cabal directives > intended to support NHC98 and versions of GHC before 7.0. However, our > TravisCI script tests only GHC versions 7.0 and above. It is therefore > likely that the compatibility code is bit-rotted to some extent. Wren > Romano and I are strongly inclined to immediately remove all code > intended to support NHC98 or pre-7.0 GHC. If anyone uses any such > implementations with the current version of containers, please speak > now or forever hold your peace. > > Thanks, > David Feuer > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chneukirchen at gmail.com Mon Apr 25 12:47:14 2016 From: chneukirchen at gmail.com (Christian Neukirchen) Date: Mon, 25 Apr 2016 14:47:14 +0200 Subject: [Haskell-cafe] Munich Haskell Meeting, 2016-04-28 @ 19:30 Message-ID: <87mvohx3cd.fsf@gmail.com> Dear all, This week, our monthly Munich Haskell Meeting will take place again on Thursday, April 28 at Cafe Puck at 19h30. For details see here: http://chneukirchen.github.io/haskell-munich.de/dates.html If you plan to join, please add yourself to this dudle so we can reserve enough seats! It is OK to add yourself to the dudle anonymously or pseudonymously. https://dudle.inf.tu-dresden.de/haskell-munich-apr-2016/ Everybody is welcome! cu, -- Christian Neukirchen http://chneukirchen.org From bertram.felgenhauer at googlemail.com Mon Apr 25 14:07:05 2016 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Mon, 25 Apr 2016 16:07:05 +0200 Subject: [Haskell-cafe] Is it possible to make lazy combinators for IO? (Was: (no subject)) In-Reply-To: References: <20160424200740.AC81DBCF64@haskell.org> <20160424210759.GA9708@weber> <20160424212024.GA2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> <20160424220828.GB2064@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: <20160425140704.GA18336@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> David Feuer wrote: > Spectacular! That looks like just what I wanted! Unless there are some > hidden gotchas, it might be worth making a package of that. I can think of one nasty surprise: if liftIO is implemented using `unsafeIOToST` then it becomes dupable in the `unsafeDupablePerformIO` sense. It's quite delicate but something along the lines of r <- newIORef "" replicateM 2 $ forkIO $ runMyIO $ do ((), _) <- mfix $ \(x, y) -> do x <- liftIO $ writeIORef r y y <- getLine return (x,y) last [1..] `seq` return () could trigger the `getLine` operation from different threads simultaneously. The upshot is that `liftIO` should employ `noDuplicate#` to prevent this scenario. Cheers, Bertram For reference: > newtype MyIO a = MyIO (LST.ST RealWorld a) > deriving (Functor, Applicative, Monad, MonadFix) > > instance MonadIO MyIO where > liftIO = MyIO . LSTU.unsafeIOToST > > runMyIO :: MyIO a -> IO a > runMyIO (MyIO f) = stToIO f > > main = runMyIO $ do > l <- (2:) `fmap` liftIO readLn > m <- replicateM (head l) (liftIO readLn) > liftIO (print (l :: [Int],m :: [Int])) From jeffbrown.the at gmail.com Mon Apr 25 17:43:04 2016 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Mon, 25 Apr 2016 10:43:04 -0700 Subject: [Haskell-cafe] Interactive ASCII graphics Message-ID: Gary Fixler recently gave a talk, to the Santa Monica Haskell Users Group at Brainium, in which he creates an interactive explorer for (among other images) the Mandelbrot set, using nothing but text. No complex libraries for graphics or reactivity are involved -- the only foreign import statements are to Data.Monoid, Data.Function, Data.Complex, and System.IO. The code is here: https://github.com/gfixler/continou This gif demonstrates it: http://www.garyfixler.com/2016-04-18-012037_3840x1024_scrot.gif The video is here: https://vimeo.com/163287967/99e0595942 -- Jeffrey Benjamin Brown -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Tue Apr 26 00:46:09 2016 From: david.feuer at gmail.com (David Feuer) Date: Mon, 25 Apr 2016 20:46:09 -0400 Subject: [Haskell-cafe] Cabal extensions tracking Message-ID: It's possible to enable extensions using an "extensions" field in a Cabal file, in which case Cabal will be able to report what language extensions the package requires. Unfortunately, this can be confusing, since the extensions in effect do not appear at the top of each affected module. Is there any way to get Cabal to report required extensions *based on LANGUAGE pragmas*? David From ekmett at gmail.com Tue Apr 26 03:39:29 2016 From: ekmett at gmail.com (Edward Kmett) Date: Tue, 26 Apr 2016 13:39:29 +1000 Subject: [Haskell-cafe] [core libraries] Dropping support for NHC98 and old GHC from containers In-Reply-To: References: Message-ID: We did a similar cleanup pass on base a year or two back. No objection here. Code you can't test is kinda hard to maintain forever. -Edward On Mon, Apr 25, 2016 at 2:38 PM, David Feuer wrote: > The containers package currently includes CPP and Cabal directives > intended to support NHC98 and versions of GHC before 7.0. However, our > TravisCI script tests only GHC versions 7.0 and above. It is therefore > likely that the compatibility code is bit-rotted to some extent. Wren > Romano and I are strongly inclined to immediately remove all code > intended to support NHC98 or pre-7.0 GHC. If anyone uses any such > implementations with the current version of containers, please speak > now or forever hold your peace. > > Thanks, > David Feuer > > -- > You received this message because you are subscribed to the Google Groups "haskell-core-libraries" group. > To unsubscribe from this group and stop receiving emails from it, send an email to haskell-core-libraries+unsubscribe at googlegroups.com. > For more options, visit https://groups.google.com/d/optout. From magicloud.magiclouds at gmail.com Tue Apr 26 05:39:46 2016 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Tue, 26 Apr 2016 05:39:46 +0000 Subject: [Haskell-cafe] When using Cereal, what is the right way to write `get` for multi-constructor type? Message-ID: Hi, Say I have code already like: data STH = A | B | C instance Serialize STH where put A = putWord8 1 put B = putWord8 66 put C = putWord8 111 Then what is the better way to do `get`? Is following the only one? get = do i <- getWord8 case i of 1 -> return A 66 -> return B 111 -> return C Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Tue Apr 26 06:24:27 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Tue, 26 Apr 2016 16:24:27 +1000 Subject: [Haskell-cafe] When using Cereal, what is the right way to write `get` for multi-constructor type? In-Reply-To: References: Message-ID: On 26 April 2016 at 15:39, Magicloud Magiclouds wrote: > Hi, > Say I have code already like: > data STH = A > | B > | C > instance Serialize STH where > put A = putWord8 1 > put B = putWord8 66 > put C = putWord8 111 > > Then what is the better way to do `get`? Is following the only one? > get = do > i <- getWord8 > case i of > 1 -> return A > 66 -> return B > 111 -> return C I think that covers it, though having an explicit error message for any other value of `i` will probably be better than the default unmatched case one. > > Thanks. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From giacomo at tesio.it Tue Apr 26 07:02:52 2016 From: giacomo at tesio.it (Giacomo Tesio) Date: Tue, 26 Apr 2016 09:02:52 +0200 Subject: [Haskell-cafe] [core libraries] Dropping support for NHC98 and old GHC from containers In-Reply-To: References: Message-ID: 2016-04-26 5:39 GMT+02:00 Edward Kmett : > We did a similar cleanup pass on base a year or two back. > > No objection here. > If base is not compatible with nhc98 anymore, there's a little point to preserve such compatibility on containers. Still, for less fortunate operative systems, it would be nice to have somewhere a list of modules/version actually compatible with Haskell 98. Also, for future reference, it would be nice if such change is introduced as a single-change version, so that we know it doesn't introduce or remove any other functionality except the compatibility. > Code you can't test is kinda hard to maintain forever. > I wonder what can prevent code to be tested with a different compiler... Giacomo -------------- next part -------------- An HTML attachment was scrubbed... URL: From will.yager at gmail.com Tue Apr 26 08:03:41 2016 From: will.yager at gmail.com (William Yager) Date: Tue, 26 Apr 2016 03:03:41 -0500 Subject: [Haskell-cafe] When using Cereal, what is the right way to write `get` for multi-constructor type? In-Reply-To: References: Message-ID: You may also want to use the Lambda-case extension. It will allow you to elide the declaration of i. --Will Yager On Tue, Apr 26, 2016 at 1:24 AM, Ivan Lazar Miljenovic < ivan.miljenovic at gmail.com> wrote: > On 26 April 2016 at 15:39, Magicloud Magiclouds > wrote: > > Hi, > > Say I have code already like: > > data STH = A > > | B > > | C > > instance Serialize STH where > > put A = putWord8 1 > > put B = putWord8 66 > > put C = putWord8 111 > > > > Then what is the better way to do `get`? Is following the only one? > > get = do > > i <- getWord8 > > case i of > > 1 -> return A > > 66 -> return B > > 111 -> return C > > I think that covers it, though having an explicit error message for > any other value of `i` will probably be better than the default > unmatched case one. > > > > > Thanks. > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > > > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From magicloud.magiclouds at gmail.com Tue Apr 26 08:10:49 2016 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Tue, 26 Apr 2016 08:10:49 +0000 Subject: [Haskell-cafe] When using Cereal, what is the right way to write `get` for multi-constructor type? In-Reply-To: References: Message-ID: OK. So my understanding is there is no better (good-looking) code. Thank you all. William Yager ?2016?4?26??? ??4:03??? > You may also want to use the Lambda-case extension. It will allow you to > elide the declaration of i. > > --Will Yager > > On Tue, Apr 26, 2016 at 1:24 AM, Ivan Lazar Miljenovic < > ivan.miljenovic at gmail.com> wrote: > >> On 26 April 2016 at 15:39, Magicloud Magiclouds >> wrote: >> > Hi, >> > Say I have code already like: >> > data STH = A >> > | B >> > | C >> > instance Serialize STH where >> > put A = putWord8 1 >> > put B = putWord8 66 >> > put C = putWord8 111 >> > >> > Then what is the better way to do `get`? Is following the only one? >> > get = do >> > i <- getWord8 >> > case i of >> > 1 -> return A >> > 66 -> return B >> > 111 -> return C >> >> I think that covers it, though having an explicit error message for >> any other value of `i` will probably be better than the default >> unmatched case one. >> >> > >> > Thanks. >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > >> >> >> >> -- >> Ivan Lazar Miljenovic >> Ivan.Miljenovic at gmail.com >> http://IvanMiljenovic.wordpress.com >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Tue Apr 26 08:31:57 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Tue, 26 Apr 2016 18:31:57 +1000 Subject: [Haskell-cafe] When using Cereal, what is the right way to write `get` for multi-constructor type? In-Reply-To: References: Message-ID: On 26 April 2016 at 18:10, Magicloud Magiclouds wrote: > OK. So my understanding is there is no better (good-looking) code. Thank you > all. The only other thing I can think of is that if you use the DeriveGeneric extension to derive an instance of Generic for your class, then you can do just "instance Serialize STH" and the get and put instances will be defined for you. This doesn't work if you want custom/specified values for your constructors though. > > William Yager ?2016?4?26??? ??4:03??? >> >> You may also want to use the Lambda-case extension. It will allow you to >> elide the declaration of i. >> >> --Will Yager >> >> On Tue, Apr 26, 2016 at 1:24 AM, Ivan Lazar Miljenovic >> wrote: >>> >>> On 26 April 2016 at 15:39, Magicloud Magiclouds >>> wrote: >>> > Hi, >>> > Say I have code already like: >>> > data STH = A >>> > | B >>> > | C >>> > instance Serialize STH where >>> > put A = putWord8 1 >>> > put B = putWord8 66 >>> > put C = putWord8 111 >>> > >>> > Then what is the better way to do `get`? Is following the only one? >>> > get = do >>> > i <- getWord8 >>> > case i of >>> > 1 -> return A >>> > 66 -> return B >>> > 111 -> return C >>> >>> I think that covers it, though having an explicit error message for >>> any other value of `i` will probably be better than the default >>> unmatched case one. >>> >>> > >>> > Thanks. >>> > >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > Haskell-Cafe at haskell.org >>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> > >>> >>> >>> >>> -- >>> Ivan Lazar Miljenovic >>> Ivan.Miljenovic at gmail.com >>> http://IvanMiljenovic.wordpress.com >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From rahulmutt at gmail.com Wed Apr 27 03:32:17 2016 From: rahulmutt at gmail.com (Rahul Muttineni) Date: Wed, 27 Apr 2016 09:02:17 +0530 Subject: [Haskell-cafe] When using Cereal, what is the right way to write `get` for multi-constructor type? In-Reply-To: References: Message-ID: Lennart Augustsson gave a nice example of how to define enums without having to maintain the forward as well as reverse transformations here [1]. Applying that to your problem: > instance Enum STH where > fromEnum = fromJust . flip lookup table > toEnum = fromJust . flip lookup (map swap table) > table = [(A, 1), (B, 66), (C, 111)] And then you can use the code I gave in the previous reply to generate the Serialize instance. I suppose this is better looking, but you may want to check the efficiency since it requires a lookup (but it's a super tiny table so it might not be all that bad). You can generate similar code with Template Haskell, eliding the lookup. [1] http://stackoverflow.com/questions/6000511/better-way-to-define-an-enum-in-haskell On Tue, Apr 26, 2016 at 1:40 PM, Magicloud Magiclouds < magicloud.magiclouds at gmail.com> wrote: > OK. So my understanding is there is no better (good-looking) code. Thank > you all. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- Rahul Muttineni -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Wed Apr 27 07:14:15 2016 From: davidescobar at ieee.org (David Escobar) Date: Wed, 27 Apr 2016 00:14:15 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Hi Daniel, I have another issue when using HaskellNet. It seems the way the library sends email is causing extra spaces and line breaks to be inserted in my HTML emails, which completely messes up the inline CSS styles. When I turned *sslLogToConsole = True*, this is the kind of output I get in the log: *HaskellNet-SSL SEND: "\r"* *HaskellNet-SSL SEND: "\r\n"* *HaskellNet-SSL SEND: "\r"* *HaskellNet-SSL SEND: "\r\n"* *HaskellNet-SSL SEND: "\r"* *HaskellNet-SSL SEND: "\r\n"* *HaskellNet-SSL SEND: "
CommitterSHA1 wrote: > Bardur, > > Ah, ok, that makes sense. Thanks for the clarification. > > -Dani. > > 2016-04-20 15:56 GMT+09:00 Bardur Arantsson : > >> On 04/20/2016 08:32 AM, Daniel P. Wright wrote: >> > Hello David, >> > >> >> The only thing I noticed with Gmail is that in order to work it >> requires >> > the sender's account to toggle this setting: >> >> Allow less secure apps: OFF >> > >> > That does sound unusual! Is my understanding you correctly that >> HaskellNet >> > doesn't work UNLESS you disallow less secure apps? Or is it the other >> > (more intuitive) way round? (i.e. HaskellNet is being considered a "less >> > secure" app and thus being disallowed). >> >> It's not particularly sinister... >> >> It's is simply that IMAP/SMTP do not have authentication options that >> are "secure enough" for Google[1]. Or perhaps rather that they at least >> must allow less secure authentication options per their respective >> standards/RFCs. >> >> Regards, >> >> [1] Basically they don't enforce two-factor auth. >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dani at dpwright.com Wed Apr 27 08:32:56 2016 From: dani at dpwright.com (Daniel P. Wright) Date: Wed, 27 Apr 2016 17:32:56 +0900 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: Hi David, Off the top of my head I'm not sure what the root cause of that would be, or indeed if the problem lies with HaskellNet-SSL or with HaskellNet itself. If you can send me some sample code (either by email or by filing an issue at https://github.com/dpwright/HaskellNet-SSL/issues) I can take a look at it. -Dani. 2016-04-27 16:14 GMT+09:00 David Escobar : > Hi Daniel, > I have another issue when using HaskellNet. It seems the way the library > sends email is causing extra spaces and line breaks to be inserted in my > HTML emails, which completely messes up the inline CSS styles. When I > turned *sslLogToConsole = True*, this is the kind of output I get in the > log: > > *HaskellNet-SSL SEND: "\r"* > *HaskellNet-SSL SEND: "\r\n"* > *HaskellNet-SSL SEND: " black; border-collapse: colla=\r"* > *HaskellNet-SSL SEND: "\r\n"* > *HaskellNet-SSL SEND: "pse; margin: 25px 0; width: 100%;\">\r"* > *HaskellNet-SSL SEND: "\r\n"* > *HaskellNet-SSL SEND: "\r"* > *HaskellNet-SSL SEND: "\r\n"* > *HaskellNet-SSL SEND: "
style=3D\"background-color: #072a=\r"* > *HaskellNet-SSL SEND: "\r\n"* > *HaskellNet-SSL SEND: "2d; color: white; font-weight: bold; border-right: > 1px solid white; padding=\r"* > *HaskellNet-SSL SEND: "\r\n"* > *HaskellNet-SSL SEND: ": 5px 10px; width: 33%;\">Committer white; font-weight: bold; bo=\r"* > *HaskellNet-SSL SEND: "\r\n"* > *HaskellNet-SSL SEND: "rder-right: 1px solid white; padding: 5px 10px; > width: 33%;\">SHA1 white; font-weight: bold; bo=\r"* > *HaskellNet-SSL SEND: "\r\n"* > > As you can see, extra line breaks are being inserted right in the middle > of the HTML/CSS, which completely messes it up. Is there a way to prevent > that? The only option I could find was *Settings* *sslMaxLineLength*, but > setting that to a high number doesn't solve the problem. > > Thanks, > David > > On Wed, Apr 20, 2016 at 12:00 AM, Daniel P. Wright > wrote: > >> Bardur, >> >> Ah, ok, that makes sense. Thanks for the clarification. >> >> -Dani. >> >> 2016-04-20 15:56 GMT+09:00 Bardur Arantsson : >> >>> On 04/20/2016 08:32 AM, Daniel P. Wright wrote: >>> > Hello David, >>> > >>> >> The only thing I noticed with Gmail is that in order to work it >>> requires >>> > the sender's account to toggle this setting: >>> >> Allow less secure apps: OFF >>> > >>> > That does sound unusual! Is my understanding you correctly that >>> HaskellNet >>> > doesn't work UNLESS you disallow less secure apps? Or is it the other >>> > (more intuitive) way round? (i.e. HaskellNet is being considered a >>> "less >>> > secure" app and thus being disallowed). >>> >>> It's not particularly sinister... >>> >>> It's is simply that IMAP/SMTP do not have authentication options that >>> are "secure enough" for Google[1]. Or perhaps rather that they at least >>> must allow less secure authentication options per their respective >>> standards/RFCs. >>> >>> Regards, >>> >>> [1] Basically they don't enforce two-factor auth. >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.j.larsson at gmail.com Wed Apr 27 09:47:35 2016 From: daniel.j.larsson at gmail.com (Daniel Larsson) Date: Wed, 27 Apr 2016 11:47:35 +0200 Subject: [Haskell-cafe] Interactive ASCII graphics In-Reply-To: References: Message-ID: Nice one, thanks! =) 2016-04-25 19:43 GMT+02:00 Jeffrey Brown : > Gary Fixler recently gave a talk, to the Santa Monica Haskell Users Group > at Brainium, in which he creates an interactive explorer for (among other > images) the Mandelbrot set, using nothing but text. No complex libraries > for graphics or reactivity are involved -- the only foreign import > statements are to Data.Monoid, Data.Function, Data.Complex, and System.IO. > > The code is here: > https://github.com/gfixler/continou > > This gif demonstrates it: > http://www.garyfixler.com/2016-04-18-012037_3840x1024_scrot.gif > > The video is here: > https://vimeo.com/163287967/99e0595942 > > -- > Jeffrey Benjamin Brown > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From takenobu.hs at gmail.com Wed Apr 27 12:34:15 2016 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Wed, 27 Apr 2016 21:34:15 +0900 Subject: [Haskell-cafe] Fw: Bikeshedding request for GHCi's :type Message-ID: Dear cafe, I'm forwarding mail from ghc-devs ML [1]. I think `:type` command is very important for beginners and middle users. Please feedback your opinion to them ;) [1]: https://mail.haskell.org/pipermail/ghc-devs/2016-April/011933.html > 2016-04-26 22:08 GMT+09:00 Richard Eisenberg : > Hi devs, > > Over the weekend, I was pondering the Haskell course I will be teaching next year and shuddered at having to teach Foldable at the same time as `length`. So I implemented feature request #10963 ( https://ghc.haskell.org/trac/ghc/ticket/10963), which allows for a way for a user to request a specialization of a type. It all works wonderfully, but there is a real user-facing design issue here around the default behavior of :type and whether or not to add new :type-y like commands. I have outlined the situation here: https://ghc.haskell.org/trac/ghc/wiki/Design/GHCi/Type > > I'd love some broad input on this issue. If you've got a stake in how this all works, please skim that wiki page and comment on #10963. > > Thanks! > Richard Cheers, Takenobu -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.leather at gmail.com Wed Apr 27 19:21:47 2016 From: sean.leather at gmail.com (Sean Leather) Date: Wed, 27 Apr 2016 21:21:47 +0200 Subject: [Haskell-cafe] Hackage package index download failure Message-ID: I'm unable to download the package index file used by cabal: $ cabal update Downloading the latest package list from hackage.haskell.org cabal: Failed to download http://hackage.haskell.org/packages/archive/00-index.tar.gz : ErrorMisc "Error HTTP code: 502" A few hours ago the error was a 503. Anybody know what's going on? Regards, Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed Apr 27 19:25:32 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 27 Apr 2016 20:25:32 +0100 Subject: [Haskell-cafe] Hackage package index download failure In-Reply-To: References: Message-ID: <20160427192532.GK17057@weber> On Wed, Apr 27, 2016 at 09:21:47PM +0200, Sean Leather wrote: > I'm unable to download the package index file used by cabal: > > $ cabal update > Downloading the latest package list from hackage.haskell.org > cabal: Failed to download > http://hackage.haskell.org/packages/archive/00-index.tar.gz : ErrorMisc > "Error > HTTP code: 502" > > A few hours ago the error was a 503. > > Anybody know what's going on? The same happened to me. Hackage appears to have certain problems at the moment: https://www.reddit.com/r/haskell/comments/4gppm8/ann_hackagehaskellorg_is_down/ From gershomb at gmail.com Wed Apr 27 21:10:04 2016 From: gershomb at gmail.com (Gershom B) Date: Wed, 27 Apr 2016 17:10:04 -0400 Subject: [Haskell-cafe] Summer of Haskell - Now Accepting Applications! Message-ID: (Note: I am posting this on behalf of Edward Kmett who has spotty availability at the moment) We've posted an official Summer of Haskell website: https://summer.haskell.org/ It contains the full timeline for the program this summer, and most importantly, a form for submitting student applications, also linked here: https://docs.google.com/forms/d/1JLIa58u7AcWN31bH_LcCBujN9uzAwfd3HxrT32qz9_g/viewform The student application period ends next Friday, May 6. Last year we had a very successful project brainstorming thread. This led to our largest and most successful Summer of Code, ever. There is a thread on reddit now devoted to the purpose of further brainstorming for this year: https://www.reddit.com/r/haskell/comments/4gh1tu/summer_of_haskell_now_accepting_applications/ If you have a proposal that you think a student could make a good dent in over the course of a summer, especially one with broad impact on the community, please feel free to discuss it there. If you are a potential student, please feel free to skim the proposals for ideas, or put forth ones of your own! If you are a potential mentor, please feel free to comment on proposals that interest you, put forth ideas looking for students and express your interest, to help us pair up potential students with potential mentors. Ultimately, the project proposals that are submitted get written by students, but if we can give a good sense of direction for what the community wants out of the summer, we can improve the quality of proposals, and we can recruit good mentors to work with good students on good projects. Resources: We have a wiki on https://ghc.haskell.org/trac/summer-of-code/ It is, of course, a Wiki, so if you see something out of order, take a whack at fixing it. We have an active #haskell-gsoc channel on irc.freenode.net that we run throughout the summer. Potential mentors and students alike are welcome. We have a Trac full of suggested Google Summer of Code proposals both current and from years past, but it could use a whole lot of eyeballs and an infusion of fresh ideas: https://ghc.haskell.org/trac/summer-of-code/report/1 Many of our best proposals in years have come from lists of project suggestions that others have blogged about. Many of our best students decided to join the summer of code based on these posts. The Trac isn't the only source of information on interesting projects, and I'd encourage folks to continue posting their ideas. If you or your employer would be interested in helping to fund additional students, please feel free to reach out to me. Thank you, -Edward Kmett From cdsmith at gmail.com Wed Apr 27 22:47:25 2016 From: cdsmith at gmail.com (Chris Smith) Date: Wed, 27 Apr 2016 15:47:25 -0700 Subject: [Haskell-cafe] Summer of Haskell - Now Accepting Applications! In-Reply-To: References: Message-ID: It's worth mentioning that there's a good bit of discussion, about qualifications, project ideas, etc., at https://www.reddit.com/r/haskell/comments/4gh1tu/summer_of_haskell_now_accepting_applications/ On Wed, Apr 27, 2016 at 2:10 PM, Gershom B wrote: > (Note: I am posting this on behalf of Edward Kmett who has spotty > availability at the moment) > > We've posted an official Summer of Haskell website: > > https://summer.haskell.org/ > > It contains the full timeline for the program this summer, and most > importantly, a form for submitting student applications, also linked > here: > > > https://docs.google.com/forms/d/1JLIa58u7AcWN31bH_LcCBujN9uzAwfd3HxrT32qz9_g/viewform > > The student application period ends next Friday, May 6. > > Last year we had a very successful project brainstorming thread. This > led to our largest and most successful Summer of Code, ever. > > There is a thread on reddit now devoted to the purpose of further > brainstorming for this year: > > > https://www.reddit.com/r/haskell/comments/4gh1tu/summer_of_haskell_now_accepting_applications/ > > If you have a proposal that you think a student could make a good dent > in over the course of a summer, especially one with broad impact on > the community, please feel free to discuss it there. > > If you are a potential student, please feel free to skim the proposals > for ideas, or put forth ones of your own! > > If you are a potential mentor, please feel free to comment on > proposals that interest you, put forth ideas looking for students and > express your interest, to help us pair up potential students with > potential mentors. > > Ultimately, the project proposals that are submitted get written by > students, but if we can give a good sense of direction for what the > community wants out of the summer, we can improve the quality of > proposals, and we can recruit good mentors to work with good students > on good projects. > > Resources: > > We have a wiki on https://ghc.haskell.org/trac/summer-of-code/ It is, > of course, a Wiki, so if you see something out of order, take a whack > at fixing it. > > We have an active #haskell-gsoc channel on irc.freenode.net that we > run throughout the summer. Potential mentors and students alike are > welcome. > > We have a Trac full of suggested Google Summer of Code proposals both > current and from years past, but it could use a whole lot of eyeballs > and an infusion of fresh ideas: > https://ghc.haskell.org/trac/summer-of-code/report/1 > > Many of our best proposals in years have come from lists of project > suggestions that others have blogged about. Many of our best students > decided to join the summer of code based on these posts. The Trac > isn't the only source of information on interesting projects, and I'd > encourage folks to continue posting their ideas. > > If you or your employer would be interested in helping to fund > additional students, please feel free to reach out to me. > > Thank you, > > -Edward Kmett > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cdsmith at gmail.com Wed Apr 27 22:48:16 2016 From: cdsmith at gmail.com (Chris Smith) Date: Wed, 27 Apr 2016 15:48:16 -0700 Subject: [Haskell-cafe] Summer of Haskell - Now Accepting Applications! In-Reply-To: References: Message-ID: Oops! Never mind, it was mentioned, and I missed it in the email. :) Never mind... On Wed, Apr 27, 2016 at 3:47 PM, Chris Smith wrote: > It's worth mentioning that there's a good bit of discussion, about > qualifications, project ideas, etc., at > https://www.reddit.com/r/haskell/comments/4gh1tu/summer_of_haskell_now_accepting_applications/ > > On Wed, Apr 27, 2016 at 2:10 PM, Gershom B wrote: > >> (Note: I am posting this on behalf of Edward Kmett who has spotty >> availability at the moment) >> >> We've posted an official Summer of Haskell website: >> >> https://summer.haskell.org/ >> >> It contains the full timeline for the program this summer, and most >> importantly, a form for submitting student applications, also linked >> here: >> >> >> https://docs.google.com/forms/d/1JLIa58u7AcWN31bH_LcCBujN9uzAwfd3HxrT32qz9_g/viewform >> >> The student application period ends next Friday, May 6. >> >> Last year we had a very successful project brainstorming thread. This >> led to our largest and most successful Summer of Code, ever. >> >> There is a thread on reddit now devoted to the purpose of further >> brainstorming for this year: >> >> >> https://www.reddit.com/r/haskell/comments/4gh1tu/summer_of_haskell_now_accepting_applications/ >> >> If you have a proposal that you think a student could make a good dent >> in over the course of a summer, especially one with broad impact on >> the community, please feel free to discuss it there. >> >> If you are a potential student, please feel free to skim the proposals >> for ideas, or put forth ones of your own! >> >> If you are a potential mentor, please feel free to comment on >> proposals that interest you, put forth ideas looking for students and >> express your interest, to help us pair up potential students with >> potential mentors. >> >> Ultimately, the project proposals that are submitted get written by >> students, but if we can give a good sense of direction for what the >> community wants out of the summer, we can improve the quality of >> proposals, and we can recruit good mentors to work with good students >> on good projects. >> >> Resources: >> >> We have a wiki on https://ghc.haskell.org/trac/summer-of-code/ It is, >> of course, a Wiki, so if you see something out of order, take a whack >> at fixing it. >> >> We have an active #haskell-gsoc channel on irc.freenode.net that we >> run throughout the summer. Potential mentors and students alike are >> welcome. >> >> We have a Trac full of suggested Google Summer of Code proposals both >> current and from years past, but it could use a whole lot of eyeballs >> and an infusion of fresh ideas: >> https://ghc.haskell.org/trac/summer-of-code/report/1 >> >> Many of our best proposals in years have come from lists of project >> suggestions that others have blogged about. Many of our best students >> decided to join the summer of code based on these posts. The Trac >> isn't the only source of information on interesting projects, and I'd >> encourage folks to continue posting their ideas. >> >> If you or your employer would be interested in helping to fund >> additional students, please feel free to reach out to me. >> >> Thank you, >> >> -Edward Kmett >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Thu Apr 28 07:31:43 2016 From: davidescobar at ieee.org (David Escobar) Date: Thu, 28 Apr 2016 00:31:43 -0700 Subject: [Haskell-cafe] Sending email In-Reply-To: References: Message-ID: I think I found what the problem was. I was using an Amazon SES account and even though the email got sent successfully, the HTML and CSS got messed up. When I used a regular Gmail account, the email came through with the HTML and CSS as intended. So it must be something different in the way SES expects this to be sent (what threw me off was that the email still got sent). I guess that's the reason the *Network.Mail.Mime.SES* package exists, so I'll switch over to using that one for the SES account and try and get that working. Thanks. On Wed, Apr 27, 2016 at 1:32 AM, Daniel P. Wright wrote: > Hi David, > > Off the top of my head I'm not sure what the root cause of that would be, > or indeed if the problem lies with HaskellNet-SSL or with HaskellNet > itself. If you can send me some sample code (either by email or by filing > an issue at https://github.com/dpwright/HaskellNet-SSL/issues) I can take > a look at it. > > -Dani. > > 2016-04-27 16:14 GMT+09:00 David Escobar : > >> Hi Daniel, >> I have another issue when using HaskellNet. It seems the way the library >> sends email is causing extra spaces and line breaks to be inserted in my >> HTML emails, which completely messes up the inline CSS styles. When I >> turned *sslLogToConsole = True*, this is the kind of output I get in the >> log: >> >> *HaskellNet-SSL SEND: "\r"* >> *HaskellNet-SSL SEND: "\r\n"* >> *HaskellNet-SSL SEND: "> black; border-collapse: colla=\r"* >> *HaskellNet-SSL SEND: "\r\n"* >> *HaskellNet-SSL SEND: "pse; margin: 25px 0; width: 100%;\">\r"* >> *HaskellNet-SSL SEND: "\r\n"* >> *HaskellNet-SSL SEND: "\r"* >> *HaskellNet-SSL SEND: "\r\n"* >> *HaskellNet-SSL SEND: "
> style=3D\"background-color: #072a=\r"* >> *HaskellNet-SSL SEND: "\r\n"* >> *HaskellNet-SSL SEND: "2d; color: white; font-weight: bold; border-right: >> 1px solid white; padding=\r"* >> *HaskellNet-SSL SEND: "\r\n"* >> *HaskellNet-SSL SEND: ": 5px 10px; width: 33%;\">Committer> white; font-weight: bold; bo=\r"* >> *HaskellNet-SSL SEND: "\r\n"* >> *HaskellNet-SSL SEND: "rder-right: 1px solid white; padding: 5px 10px; >> width: 33%;\">SHA1> white; font-weight: bold; bo=\r"* >> *HaskellNet-SSL SEND: "\r\n"* >> >> As you can see, extra line breaks are being inserted right in the middle >> of the HTML/CSS, which completely messes it up. Is there a way to prevent >> that? The only option I could find was *Settings* *sslMaxLineLength*, >> but setting that to a high number doesn't solve the problem. >> >> Thanks, >> David >> >> On Wed, Apr 20, 2016 at 12:00 AM, Daniel P. Wright >> wrote: >> >>> Bardur, >>> >>> Ah, ok, that makes sense. Thanks for the clarification. >>> >>> -Dani. >>> >>> 2016-04-20 15:56 GMT+09:00 Bardur Arantsson : >>> >>>> On 04/20/2016 08:32 AM, Daniel P. Wright wrote: >>>> > Hello David, >>>> > >>>> >> The only thing I noticed with Gmail is that in order to work it >>>> requires >>>> > the sender's account to toggle this setting: >>>> >> Allow less secure apps: OFF >>>> > >>>> > That does sound unusual! Is my understanding you correctly that >>>> HaskellNet >>>> > doesn't work UNLESS you disallow less secure apps? Or is it the other >>>> > (more intuitive) way round? (i.e. HaskellNet is being considered a >>>> "less >>>> > secure" app and thus being disallowed). >>>> >>>> It's not particularly sinister... >>>> >>>> It's is simply that IMAP/SMTP do not have authentication options that >>>> are "secure enough" for Google[1]. Or perhaps rather that they at least >>>> must allow less secure authentication options per their respective >>>> standards/RFCs. >>>> >>>> Regards, >>>> >>>> [1] Basically they don't enforce two-factor auth. >>>> >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Thu Apr 28 09:10:13 2016 From: ben at well-typed.com (Ben Gamari) Date: Thu, 28 Apr 2016 11:10:13 +0200 Subject: [Haskell-cafe] [ANNOUNCE] GHC 8.0.1 release candidate 4 available Message-ID: <87wpnim74a.fsf@smart-cactus.org> Hello Haskellers, The GHC team is happy to announce the availability of fourth release candidate of the Glasgow Haskell Compiler's 8.0.1 release. Source and binary distributions can be found at, http://downloads.haskell.org/~ghc/8.0.1-rc4/ This is the last of four candidates leading up to the 8.0.1 release, addressing nearly all of the known issues of the previous candidates. These include, * A type-checker panic triggered by use of Typeable on a kind-polymorphic type constructor (#11334) * A type-checker explosion where -XTypeInType would gobble up massive amounts of memory when used in a data instance (#11407) * A variety of other typechecker issues (#11811, #11797, #11813, #11814) * A build issue seen on OS X (#11828) * Template Haskell can now produce instances with OVERLAPP{ING,ABLE,ED} pragmas * Autoconf has improved version checks for libdw (#11820) * Typeable and hs-boot files now interact nicely (#11824) * The build system now checks for the broken Apple `nm` utility (#11823, #11744) * Various issues involving unexpected laziness resulting in exception handlers not being invoked (#11555) * GHC now fails more gracefully when used with an older cabal-install release (#11558) * TypeInType now has proper documentation in the users guide (#11614) * The story surrounding type `RuntimeRep`s (formerly known as `Levity`) is now far better developed, closing several doors to unsafe behavior that TypeInType previously opened (#11473, #11723) * A long-standing bug in the constant-folding rules for `mod` for the `Word` type has been resolved (#11702) * Various issues introduced by OverloadedRecordFields have been fixed (#11662, #11401) * A regression in the typechecker resulting in the rejection of code in the `free` and `microlens` packages has been fixed (#11608) * A bug in the LLVM code generator which caused some programs to emit unbuildable LLVM IR has been fixed (#11649) * A bug where pattern synonyms defined in terms of a pattern match on a record would be rejected if the fields weren't written in the same order as they were defined has been resolved (#11633) * A bug in the runtime system's treatment of weak references which could result in segmentation faults in some cases has been fixed (#11108) * a variety of optimizations improving compiler performance have been merged * and many others Mac OS X users should be aware that the recent XCode 7.3 release ships with a broken `nm` utility which breaks the GHC build (#11744, #11823). The build system will check for this condition and request that the tree is configured to use the `nm-classic` utility if found. OS X users running XCode 7.3 are encouraged to open a ticket with Apple so that this issue may be fixed in future XCode releases. If no major issues pop up we expect that this will be the last release candidate before the final release, which we hope to push out in the coming weeks. Thanks to everyone who has contributed code, testing, builds, and bug reports thusfar! Cheers and happy testing, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From hvriedel at gmail.com Thu Apr 28 09:57:54 2016 From: hvriedel at gmail.com (Herbert Valerio Riedel) Date: Thu, 28 Apr 2016 11:57:54 +0200 Subject: [Haskell-cafe] ANN: Haskell Prime 2020 committee has formed Message-ID: <874mamjbrx.fsf@gmail.com> Dear Haskell Community! Some time ago I asked for nominations to reboot the Haskell Prime process[1], and now I'm pleased to finally announce the formation of the new Haskell Language 2020 Committee! The goal of the Haskell Language committee together with the Core Libraries Committee is to work towards a new Haskell 2020 Language Report. I'd like to remind everyone that the Haskell Prime Process[4] relies on *everyone* in the community to help by contributing proposals which the committee will then evaluate and if suitable help formalise for inclusion. Everyone interested in participating is also invited to join the haskell-prime mailing list. Four years (or rather ~3.5 years) from now may seem like a long time. However, given the magnitude of the task at hand, to discuss, formalise, and implement proposed extensions (taking into account the recently enacted three-release-policy[3]) to the Haskell Report, the process shouldn't be rushed. Consequently, this may even turn out to be a tight schedule after all. However, it's not excluded there may be an interim revision of the Haskell Report before 2020. Based on this schedule, GHC 8.8 (likely to be released early 2020) would be the first GHC release to feature Haskell 2020 compliance. Prior GHC releases may be able to provide varying degree of conformance to drafts of the upcoming Haskell 2020 Report. The Haskell Language 2020 committee starts out with 20 members which contribute a diversified skill-set. These initial members also represent the Haskell community from the perspective of practitioners, implementers, educators, and researchers. - Andres L?h - Antonio Nikishaev - Austin Seipp - Carlos Camarao de Figueiredo - Carter Schonwald - David Luposchainsky - Henk-Jan van Tuyl - Henrik Nilsson - Herbert Valerio Riedel - Iavor Diatchki - John Wiegley - Jos? Manuel Calder?n Trilla - Jurriaan Hage - Lennart Augustsson - M Farkas-Dyck - Mario Bla?evi? - Nicolas Wu - Richard Eisenberg - Vitaly Bragilevsky - Wren Romano The Haskell 2020 committee is a language committee; it will focus its efforts on specifying the Haskell language itself. Responsibility for the libraries laid out in the Report is left to the Core Libraries Committee (CLC)[5]. Incidentally, the CLC still has an available seat[2]; if you would like to contribute to the Haskell 2020 Core Libraries you are encouraged to apply for this opening. As this is a general announcement broadcasted to multiple mailing lists, a separate email discussing the next steps of the new committee will be sent to the haskell-prime mailing list shortly. [1]: https://mail.haskell.org/pipermail/haskell-prime/2015-September/003936.html [2]: https://mail.haskell.org/pipermail/libraries/2015-November/026497.html [3]: https://prime.haskell.org/wiki/Libraries/3-Release-Policy [4]: https://prime.haskell.org/wiki/Process [5]: https://prime.haskell.org/wiki/Libraries -- hvr -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 818 bytes Desc: not available URL: From anfelor at posteo.de Thu Apr 28 14:05:16 2016 From: anfelor at posteo.de (Anton Felix Lorenzen) Date: Thu, 28 Apr 2016 16:05:16 +0200 Subject: [Haskell-cafe] Fw: Bikeshedding request for GHCi's :type In-Reply-To: <572110A1.9080606@posteo.de> References: <572110A1.9080606@posteo.de> Message-ID: <5722189C.7050104@posteo.de> As a middle user, I often depend on `:type` when learning a library. I don't have strong preferences over one proposal or the other, but I would like to add, that there should always be `:type` in its current form (renamed or not). I wouldn't like getting lots of for me irrelevant information, like examples, when I only want a one-line type signature. That said, I like the general idea, although I don't know, whether a beginner would like having to learn the type signatures again, when getting to a more advanced level. - Anton Lorenzen From mike at barrucadu.co.uk Thu Apr 28 15:52:35 2016 From: mike at barrucadu.co.uk (Michael Walker) Date: Thu, 28 Apr 2016 16:52:35 +0100 Subject: [Haskell-cafe] Call for Contributions - Haskell Communities and Activities Report, May 2016 edition (30th edition) In-Reply-To: References: Message-ID: <20160428165235.3c92e46a@azathoth> Hi, Attached is a new submission on dejafu. Thanks On Sun, 3 Apr 2016 19:24:10 -0400 Mihai Maruseac wrote: > Dear all, > > It's that time of the year again (https://ro-che.info/ccc/16). :) > > We would like to collect contributions for the 30th edition of the > > ============================================================ > Haskell Communities & Activities Report > > http://www.haskell.org/haskellwiki/Haskell_Communities_and_Activities_Report > > Submission deadline: 30 April 2016 > > ============================================================ > > The short story follows: > > * If you are working on _any_ project that is in some way related to > Haskell, please write a short entry and submit it. Even if the project > is small, unfinished or used only by yourself or you think it is not > important enough, please reconsider and submit an entry anyway! > > * The submission file can be in _any_ format you like. Although the > final report uses LaTeX, if it is easier for you to submit a Markdown > file, text file, Doc file or anything else, please do so. We'll be > happy to do the translation and get a new entry in the HCAR :) > > * If you are interested in an existing project related to Haskell that > has not previously been mentioned in the HCAR, please tell me or > contact a project leader to get them to submit an entry. We have > received feedback in the past that some projects were missing from the > edition, but, sadly, that was too late at the time, but those projects > will be contacted for this edition. > > * Feel free to pass on this call for contribution to others that might > be interested. > > More detailed information: > > The Haskell Communities & Activities Report is a bi-annual overview of > the state of Haskell as well as Haskell-related projects over the > last, and possibly the upcoming six months. If you have only recently > been exposed to Haskell, it might be a good idea to browse the > previous edition --- you will find interesting projects described as > well as several starting points and links that may provide answers to > many questions. > > Contributions will be collected until the submission deadline. They > will then be compiled into a coherent report that is published online > as soon as it is ready. As always, this is a great opportunity to > update your webpages, make new releases, announce or even start new > projects, or to talk about developments you want every Haskeller to > know about! > > Looking forward to your contributions, > > Mihai > > FAQ: > > Q: What format should I write in? > > A: The recommeneded format is a LaTeX source file, adhering to the > template that is available at: > > http://haskell.org/communities/05-2016/template.tex > > There is also a LaTeX style file at > > http://haskell.org/communities/06-2016/hcar.sty > > that you can use to preview your entry. > > If you modify an old entry that you have written for an earlier > edition of the report, you should soon receive your old entry as a > template (provided we have your valid email address). Please modify > that template, rather than using your own version of the old entry as > a template. > > _However_, if you don't want/have time to format the entry for LaTeX, > you can submit it in any other format possible and we will be happy to > convert it for the final report. > > Q: Can I include Haskell code? > > A: Yes. Please use lhs2tex syntax > (http://www.andres-loeh.de/lhs2tex/). The report is compiled in mode > polycode.fmt. > > Q: Can I include images? > > A: Yes, you are even encouraged to do so. Please use .jpg or .png > format, then, PNG being preferred for simplicity. > > Q: How much should I write? > > A: Authors are asked to limit entries to about one column of text. A > general introduction is helpful. Apart from that, you should focus on > recent or upcoming developments. Pointers to online content can be > given for more comprehensive or "historic" overviews of a project. > Images do not count towards the length limit, so you may want to use > this opportunity to pep up entries. There is no minimum length of an > entry! > > The report aims for being as complete as possible, so please consider > writing an entry, even if it is only a few lines long. > > Q: Which topics are relevant? > > A: All topics which are related to Haskell in some way are relevant. > We usually had reports from users of Haskell (private, academic, or > commercial), from authors or contributors to projects related to > Haskell, from people working on the Haskell language, libraries, on > language extensions or variants. We also like reports about > distributions of Haskell software, Haskell infrastructure, books and > tutorials on Haskell. Reports on past and upcoming events related to > Haskell are also relevant. > > Finally, there might be new topics we do not even think about. As a > rule of thumb: if in doubt, then it probably is relevant and has a > place in the HCAR. You can also simply ask us. > > Q: Is unfinished work relevant? Are ideas for projects relevant? > > A: Yes! You can use the HCAR to talk about projects you are currently > working on. You can use it to look for other developers that might > help you. You can use HCAR to ask for more contributors to your > project, it is a good way to gain visibility and traction. > > Q: If I do not update my entry, but want to keep it in the report, > what should I do? > > A: Tell us that there are no changes. The old entry will typically be > reused in this case, but it might be dropped if it is older than a > year, to give more room and more attention to projects that change a > lot. Do not resend complete entries if you have not changed them. > > Q: Will I get confirmation if I send an entry? How do I know whether > my email has even reached its destination, and not ended up in a spam > folder? > > A: Prior to publication of the final report, we will send a draft to > all contributors, for possible corrections. So if you do not hear from > us within two weeks after the deadline, it is safer to send another > mail and check whether your first one was received. > -- Michael Walker (http://www.barrucadu.co.uk) -------------- next part -------------- A non-text attachment was scrubbed... Name: hcar.tex Type: text/x-tex Size: 2507 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: From diaz.carrete at gmail.com Thu Apr 28 19:35:52 2016 From: diaz.carrete at gmail.com (=?UTF-8?Q?Daniel_D=C3=ADaz?=) Date: Thu, 28 Apr 2016 12:35:52 -0700 (PDT) Subject: [Haskell-cafe] Fw: Bikeshedding request for GHCi's :type In-Reply-To: References: Message-ID: I like the flag idea mentioned by Eric Seidel: > Perhaps instead of changing the default behavior of :type or adding new commands, we could add a flag to enhance :type's output. Would it be overkill to have two flags, one that enabled showing the full type + specializations, and a "newbie mode" flag that only showed a few specializations? Daniel. On Wednesday, April 27, 2016 at 2:34:29 PM UTC+2, Takenobu Tani wrote: > > Dear cafe, > > I'm forwarding mail from ghc-devs ML [1]. > > I think `:type` command is very important for beginners and middle users. > Please feedback your opinion to them ;) > > [1]: https://mail.haskell.org/pipermail/ghc-devs/2016-April/011933.html > > > > 2016-04-26 22:08 GMT+09:00 Richard Eisenberg >: > > Hi devs, > > > > Over the weekend, I was pondering the Haskell course I will be teaching > next year and shuddered at having to teach Foldable at the same time as > `length`. So I implemented feature request #10963 ( > https://ghc.haskell.org/trac/ghc/ticket/10963), which allows for a way > for a user to request a specialization of a type. It all works wonderfully, > but there is a real user-facing design issue here around the default > behavior of :type and whether or not to add new :type-y like commands. I > have outlined the situation here: > https://ghc.haskell.org/trac/ghc/wiki/Design/GHCi/Type > > > > I'd love some broad input on this issue. If you've got a stake in how > this all works, please skim that wiki page and comment on #10963. > > > > Thanks! > > Richard > > Cheers, > Takenobu > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From acopton at gmail.com Thu Apr 28 21:42:16 2016 From: acopton at gmail.com (Alexander Bernauer) Date: Thu, 28 Apr 2016 23:42:16 +0200 Subject: [Haskell-cafe] [ANN] Pre-announcing ZuriHac 2016 Message-ID: Hello fellow Haskellers, it's my pleasure to announce that this year's ZuriHac, the Zurich Haskell hackathon, will happen from July 22nd to 24th. The registration will open this Saturday at 12pm (UTC+2). More information will follow. Greetings, Alex on behalf of the orga team -------------- next part -------------- An HTML attachment was scrubbed... URL: From parsonsmatt at gmail.com Thu Apr 28 22:24:31 2016 From: parsonsmatt at gmail.com (Matt) Date: Thu, 28 Apr 2016 18:24:31 -0400 Subject: [Haskell-cafe] Fw: Bikeshedding request for GHCi's :type In-Reply-To: References: Message-ID: It seems that we really want is something like Idris's `:doc` command: Idris> :doc map > Prelude.Functor.map : Functor f => (m : a -> b) -> f a -> f b > Apply a function across everything of type 'a' in a > parameterised type > > The function is Total > > Idris> :doc length > Prelude.List.length : List a -> Nat > Compute the length of a list. > > Runs in linear time > > The function is Total > Prelude.Strings.length : String -> Nat > Returns the length of the string. > > > length "" > 0 > > > length "ABC" > 3 > > The function is Total I don't like the idea of making `:type` more complicated, and I think this would satisfy the need for understanding much more effectively. Matt Parsons On Thu, Apr 28, 2016 at 3:35 PM, Daniel D?az wrote: > I like the flag idea mentioned by Eric Seidel: > > > Perhaps instead of changing the default behavior of :type or adding new > > commands, we could add a flag to enhance :type's output. > > > Would it be overkill to have two flags, one that enabled showing the full type + specializations, and a "newbie mode" flag that only showed a few specializations? > > > Daniel. > > > On Wednesday, April 27, 2016 at 2:34:29 PM UTC+2, Takenobu Tani wrote: >> >> Dear cafe, >> >> I'm forwarding mail from ghc-devs ML [1]. >> >> I think `:type` command is very important for beginners and middle users. >> Please feedback your opinion to them ;) >> >> [1]: https://mail.haskell.org/pipermail/ghc-devs/2016-April/011933.html >> >> >> > 2016-04-26 22:08 GMT+09:00 Richard Eisenberg : >> > Hi devs, >> > >> > Over the weekend, I was pondering the Haskell course I will be teaching >> next year and shuddered at having to teach Foldable at the same time as >> `length`. So I implemented feature request #10963 ( >> https://ghc.haskell.org/trac/ghc/ticket/10963), which allows for a way >> for a user to request a specialization of a type. It all works wonderfully, >> but there is a real user-facing design issue here around the default >> behavior of :type and whether or not to add new :type-y like commands. I >> have outlined the situation here: >> https://ghc.haskell.org/trac/ghc/wiki/Design/GHCi/Type >> > >> > I'd love some broad input on this issue. If you've got a stake in how >> this all works, please skim that wiki page and comment on #10963. >> > >> > Thanks! >> > Richard >> >> Cheers, >> Takenobu >> >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From takenobu.hs at gmail.com Fri Apr 29 05:17:36 2016 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Fri, 29 Apr 2016 14:17:36 +0900 Subject: [Haskell-cafe] [ANNOUNCE] GHC 8.0.1 release candidate 4 available In-Reply-To: <87wpnim74a.fsf@smart-cactus.org> References: <87wpnim74a.fsf@smart-cactus.org> Message-ID: Hi Ben, Richard and GHC team, I appreciate your great effort. The rc4 simply represents `$` type in ghci. $ ./ghcii.sh GHCi, version 8.0.0.20160421: http://www.haskell.org/ghc/ :? for help Prelude> :t ($) ($) :: (a -> b) -> a -> b Newcomers may love it :) Thank you very much, Takenobu 2016-04-28 18:10 GMT+09:00 Ben Gamari : > > Hello Haskellers, > > The GHC team is happy to announce the availability of fourth release > candidate of the Glasgow Haskell Compiler's 8.0.1 release. Source and > binary distributions can be found at, > > http://downloads.haskell.org/~ghc/8.0.1-rc4/ > > This is the last of four candidates leading up to the 8.0.1 release, > addressing nearly all of the known issues of the previous candidates. > These include, > > * A type-checker panic triggered by use of Typeable on a > kind-polymorphic type constructor (#11334) > > * A type-checker explosion where -XTypeInType would gobble up massive > amounts of memory when used in a data instance (#11407) > > * A variety of other typechecker issues (#11811, #11797, #11813, > #11814) > > * A build issue seen on OS X (#11828) > > * Template Haskell can now produce instances with > OVERLAPP{ING,ABLE,ED} pragmas > > * Autoconf has improved version checks for libdw (#11820) > > * Typeable and hs-boot files now interact nicely (#11824) > > * The build system now checks for the broken Apple `nm` utility > (#11823, #11744) > > * Various issues involving unexpected laziness resulting in exception > handlers not being invoked (#11555) > > * GHC now fails more gracefully when used with an older cabal-install > release (#11558) > > * TypeInType now has proper documentation in the users guide (#11614) > > * The story surrounding type `RuntimeRep`s (formerly known as > `Levity`) is now far better developed, closing several doors to > unsafe behavior that TypeInType previously opened (#11473, #11723) > > * A long-standing bug in the constant-folding rules for `mod` for the > `Word` type has been resolved (#11702) > > * Various issues introduced by OverloadedRecordFields have been fixed > (#11662, #11401) > > * A regression in the typechecker resulting in the rejection of code > in the `free` and `microlens` packages has been fixed (#11608) > > * A bug in the LLVM code generator which caused some programs to emit > unbuildable LLVM IR has been fixed (#11649) > > * A bug where pattern synonyms defined in terms of a pattern match on > a record would be rejected if the fields weren't written in the same > order > as they were defined has been resolved (#11633) > > * A bug in the runtime system's treatment of weak references which > could result in segmentation faults in some cases has been fixed > (#11108) > > * a variety of optimizations improving compiler performance have been > merged > > * and many others > > Mac OS X users should be aware that the recent XCode 7.3 release ships > with a broken `nm` utility which breaks the GHC build (#11744, #11823). > The build system will check for this condition and request that the tree > is configured to use the `nm-classic` utility if found. OS X users > running XCode 7.3 are encouraged to open a ticket with Apple so that > this issue may be fixed in future XCode releases. > > If no major issues pop up we expect that this will be the last release > candidate before the final release, which we hope to push out in the > coming weeks. Thanks to everyone who has contributed code, testing, > builds, and bug reports thusfar! > > Cheers and happy testing, > > - Ben > > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Fri Apr 29 06:45:23 2016 From: davidescobar at ieee.org (David Escobar) Date: Thu, 28 Apr 2016 23:45:23 -0700 Subject: [Haskell-cafe] Amazon SES email issues Message-ID: Hi everyone, I'm having issues with sending email through Amazon SES. I'm using the *Network.Mail.Mime.SES* package. The error I get is: *email-test-exe: SESException {seStatus = Status {statusCode = 403, statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage = "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.", seRequestId = "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* What's confusing is that I'm using the same SES settings in a Rails app as well as a small Rust console program without any issues (it works from the same machine too). The only thing I can think of is that with this Haskell package, I haven't found where to set certain things like the port number (587) and so maybe it's that? Here is a small sample app that illustrates the problem. What am I missing? Thanks. *{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE QuasiQuotes #-}* *module Main where* *import Data.Function ((&))import GHC.Genericsimport Network.HTTP.Clientimport Network.HTTP.Client.TLSimport Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack "de at somewhere.com ", sesTo = [ C8.pack "someone.else at somewhereelse.com " ], sesAccessKey = "SOMEAWSACCESSKEY", sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") "de at somewhere.com ", mailTo = [ Address (Just "Someone Else") "someone.else at somewhereelse.com " ], mailParts = [ [ htmlPart testEmail ] ], mailCc = [], mailBcc = [], mailHeaders = [ ("subject", "Some Test Email"), ("Content-Type", "text/html; charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig emailtestEmail :: LT.TexttestEmail = let rows = [ [ "1", "2", "3" ], [ "4", "5", "6" ]] in renderHtml [shamlet| $doctype 5
Column 1 Column 2 Column 3 $forall row <- rows
#{T.pack $ row !! 0} #{T.pack $ row !! 1} #{T.pack $ row !! 2} |] & LT.pack* -------------- next part -------------- An HTML attachment was scrubbed... URL: From djohnson.m at gmail.com Fri Apr 29 14:07:41 2016 From: djohnson.m at gmail.com (David Johnson) Date: Fri, 29 Apr 2016 09:07:41 -0500 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: References: Message-ID: I think that package is using an outdated version of the AWS Signing algorithm. "AWS3-HTTPS" I think AWS is migrating most of their APIs (who have domains / services created after a certain date) to require using the V4 Signature algorithm for all API requests. The amazonka-ses would probably work better. On Fri, Apr 29, 2016 at 1:45 AM, David Escobar wrote: > Hi everyone, > I'm having issues with sending email through Amazon SES. I'm using the > *Network.Mail.Mime.SES* package. The error I get is: > > *email-test-exe: SESException {seStatus = Status {statusCode = 403, > statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage = > "The request signature we calculated does not match the signature you > provided. Check your AWS Secret Access Key and signing method. Consult the > service documentation for details.", seRequestId = > "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* > > What's confusing is that I'm using the same SES settings in a Rails app as > well as a small Rust console program without any issues (it works from the > same machine too). The only thing I can think of is that with this Haskell > package, I haven't found where to set certain things like the port number > (587) and so maybe it's that? Here is a small sample app that illustrates > the problem. What am I missing? Thanks. > > > > *{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE QuasiQuotes #-}* > *module Main where* > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *import Data.Function ((&))import GHC.Genericsimport > Network.HTTP.Clientimport Network.HTTP.Client.TLSimport > Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet > (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import > qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport > qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager > tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack > "de at somewhere.com ", sesTo = [ > C8.pack "someone.else at somewhereelse.com " > ], sesAccessKey = "SOMEAWSACCESSKEY", > sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", > sesRegion = usEast1 } email = Mail { mailFrom = Address (Just > "David Escobar") "de at somewhere.com ", > mailTo = [ Address (Just "Someone Else") "someone.else at somewhereelse.com > " ], mailParts = [ [ > htmlPart testEmail ] ], mailCc = [], > mailBcc = [], mailHeaders = [ ("subject", "Some Test > Email"), ("Content-Type", "text/html; > charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig > emailtestEmail :: LT.TexttestEmail = let rows = [ [ "1", "2", "3" ], [ > "4", "5", "6" ]] in renderHtml [shamlet| $doctype 5 > style="background-color: #f8f9ee;">
style="background-color: #072a2d; color: white; font-weight: bold; > border-right: 1px solid white; padding: 5px 10px; width: 33%;"> > Column 1 Column 2 style="background-color: #072a2d; color: white; font-weight: bold; > border-right: 1px solid white; padding: 5px 10px; width: 33%;"> > Column 3 $forall row <- rows
> #{T.pack $ row !! 0} > #{T.pack $ row !! 1} > #{T.pack $ row !! 2} |] & LT.pack* > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- Cell: 1.630.740.8204 -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaumh at gmail.com Fri Apr 29 15:03:53 2016 From: guillaumh at gmail.com (Guillaume Hoffmann) Date: Fri, 29 Apr 2016 12:03:53 -0300 Subject: [Haskell-cafe] [ANN] Darcs 2.12.0 release Message-ID: Hi all, The Darcs team is pleased to announce the release of Darcs 2.12.0. # Downloading # One way of installing Darcs 2.12.0 is with stack: $ stack install darcs-2.12.0 Or first install the Haskell Platform (http://www.haskell.org/platform) and install Darcs with cabal-install: $ cabal update $ cabal install darcs-2.12.0 You can also download the tarball from http://darcs.net/releases/darcs-2.12.0.tar.gz and build it by hand. The 2.12 branch is also available as a darcs repository from http://darcs.net/releases/branch-2.12 # What's new since Darcs 2.10.3 # ## New features ## * `darcs show dependencies`: export patch dependency graph as dot file (Ale Gadea) ## User Interface ## * improvements in `darcs record` output with irrelevant files (Ben Franksen) * `darcs log -v --machine-readable`: show internal representation of patches (including explicit dependencies). Remove patch viewing via the "darcs annotate" command. (Guillaume Hoffmann) * `whatsnew -s` (and `status`) show conflicting files (Guillaume Hoffmann) * honor "quiet" flag in command outputs (Ben Franksen) * a single `show patch-index` command (Guillaume Hoffmann) * remove deprecated aliases of show (Guillaume Hoffmann) * remove hack to enable arbitrary protocols via env variables (Guillaume Hoffmann) ## Performance ## * handle file moves natively when importing from git (Owen Stephens) ## Developer-related ## * require GHC 7.6 (base > 4.6) and support GHC 8 (Ganesh Sittampalam) * switch to sandi from dataenc (Daniil Frumin) * refactoring to prepare stash (Ganesh Sittampalam) * change argument order of type witness RL (Ben Franksen) * Darcs.Repository / repository cloning refactoring (Ben Franksen) * use of async when cloning with packs (Ben Franksen) * SSH code refactoring (Ben Franksen) * Patch and RealPatch renamed to RepoPatchV1 and RepoPatchV2 (Guillaume Hoffmann) * merged hashed-storage into libdarcs and hashed-storage tests into darcs-test (Guillaume Hoffmann) * reorganize Darcs.Repository.* modules (Guillaume Hoffmann) ## Issues resolved in Darcs 2.12 ## * issue1807: clarify help of PAGER, DARCS_PAGER (Guillaume Hoffmann) * issue2258: improve patch index error message with suggestion (Guillaume Hoffmann) * issue2269: push hijack test to suspend time (Eric Kow) * issue2276: Keep track of patch hijack decisions (Eric Kow) * issue2138: report conflicting files in whatsnew -s (Guillaume Hoffmann) * issue2393: remove whatsnew functionality from annotate (Guillaume Hoffmann) * issue2400: use async package to keep track of unpack threads (Ben Franksen) * issue2459: fall back to writing the file if createLink fails (Ben Franksen) * issue2479: root dir most not be among the sources of a move (Ben Franksen) * issue2481: expose API for 'darcs diff' command (Ganesh Sittampalam) * issue2486: obliterate --not-in-remote -q should be more quiet (Ben Franksen) * issue2489: dequote filepaths while importing from git (Guillaume Hoffmann) * issue2494: output of darcs record with file arguments (Ben Franksen) Thanks! Guillaume From ydewit at gmail.com Fri Apr 29 15:20:11 2016 From: ydewit at gmail.com (Yuri de Wit) Date: Fri, 29 Apr 2016 12:20:11 -0300 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: References: Message-ID: Also, make sure the time on the machine you are running this client didn't drift too far from the server's time. If this delta crosses a threshold, you will see similar issues. On Fri, Apr 29, 2016 at 11:07 AM, David Johnson wrote: > I think that package is using an outdated version of the AWS Signing > algorithm. > > "AWS3-HTTPS" > I think AWS is migrating most of their APIs (who have domains / services created after a certain date) to require using the V4 Signature algorithm for all API requests. > > The amazonka-ses would probably work better. > > > On Fri, Apr 29, 2016 at 1:45 AM, David Escobar > wrote: > >> Hi everyone, >> I'm having issues with sending email through Amazon SES. I'm using the >> *Network.Mail.Mime.SES* package. The error I get is: >> >> *email-test-exe: SESException {seStatus = Status {statusCode = 403, >> statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage = >> "The request signature we calculated does not match the signature you >> provided. Check your AWS Secret Access Key and signing method. Consult the >> service documentation for details.", seRequestId = >> "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* >> >> What's confusing is that I'm using the same SES settings in a Rails app >> as well as a small Rust console program without any issues (it works from >> the same machine too). The only thing I can think of is that with this >> Haskell package, I haven't found where to set certain things like the port >> number (587) and so maybe it's that? Here is a small sample app that >> illustrates the problem. What am I missing? Thanks. >> >> >> >> *{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE QuasiQuotes #-}* >> *module Main where* >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *import Data.Function ((&))import GHC.Genericsimport >> Network.HTTP.Clientimport Network.HTTP.Client.TLSimport >> Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet >> (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import >> qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport >> qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager >> tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack >> "de at somewhere.com ", sesTo = [ >> C8.pack "someone.else at somewhereelse.com " >> ], sesAccessKey = "SOMEAWSACCESSKEY", >> sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", >> sesRegion = usEast1 } email = Mail { mailFrom = Address (Just >> "David Escobar") "de at somewhere.com ", >> mailTo = [ Address (Just "Someone Else") "someone.else at somewhereelse.com >> " ], mailParts = [ [ >> htmlPart testEmail ] ], mailCc = [], >> mailBcc = [], mailHeaders = [ ("subject", "Some Test >> Email"), ("Content-Type", "text/html; >> charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig >> emailtestEmail :: LT.TexttestEmail = let rows = [ [ "1", "2", "3" ], [ >> "4", "5", "6" ]] in renderHtml [shamlet| $doctype 5 >> > style="background-color: #f8f9ee;">
> style="background-color: #072a2d; color: white; font-weight: bold; >> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >> Column 1 Column 2 > style="background-color: #072a2d; color: white; font-weight: bold; >> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >> Column 3 $forall row <- rows
>> #{T.pack $ row !! 0} >> #{T.pack $ row !! 1} >> #{T.pack $ row !! 2} |] & LT.pack* >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > > > -- > Cell: 1.630.740.8204 > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From acopton at gmail.com Fri Apr 29 20:47:05 2016 From: acopton at gmail.com (Alexander Bernauer) Date: Fri, 29 Apr 2016 22:47:05 +0200 Subject: [Haskell-cafe] [ANN] Pre-announcing ZuriHac 2016 In-Reply-To: References: Message-ID: The web site ist now online. See https://wiki.haskell.org/ZuriHac2016 On Thu, Apr 28, 2016 at 11:42 PM, Alexander Bernauer wrote: > Hello fellow Haskellers, > > > it's my pleasure to announce that this year's ZuriHac, the Zurich Haskell > hackathon, will happen from July 22nd to 24th. > > > The registration will open this Saturday at 12pm (UTC+2). More information > will follow. > > > Greetings, > > Alex > on behalf of the orga team > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wangbj at gmail.com Sat Apr 30 06:43:14 2016 From: wangbj at gmail.com (Baojun Wang) Date: Sat, 30 Apr 2016 06:43:14 +0000 Subject: [Haskell-cafe] cannot perform arithmetic with GHC.TypeLits? Message-ID: Hi List, When I try to build below program, the compiler complains Couldn't match type ?n? with ?1 + (n - 1)? ? Why GHC (7.10.3) cannot do type level natural number arithmetic? `` n /= 1 + (n-1)`` at type level? -- | main.hs {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DeriveGeneric #-} module Main where import qualified Data.ByteString as B import Data.ByteString(ByteString) import Data.Serialize -- require cereal import GHC.TypeLits data Scalar :: Nat -> * -> * where Nil :: Scalar 0 a Cons :: a -> Scalar m a -> Scalar (1+m) a instance (Serialize a) => Serialize (Scalar 0 a) where get = return Nil put _ = return $ mempty instance (Serialize a) => Serialize (Scalar n a) where get = do x <- get :: Get a xs <- get :: Get (Scalar (n-1) a) return $! Cons x xs put (Cons x xs) = do put (x :: a) put xs -- /tmp/vect1/app/Main.hs:31:15: Couldn't match type ?n? with ?1 + (n - 1)? ? ?n? is a rigid type variable bound by the instance declaration at /tmp/vect1/app/Main.hs:27:10 Expected type: Scalar n a Actual type: Scalar (1 + (n - 1)) a Relevant bindings include xs :: Scalar (n - 1) a (bound at /tmp/vect1/app/Main.hs:30:5) get :: Get (Scalar n a) (bound at /tmp/vect1/app/Main.hs:28:3) In the second argument of ?($!)?, namely ?Cons x xs? In a stmt of a 'do' block: return $! Cons x xs Compilation failed. - baojun -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Sat Apr 30 07:04:09 2016 From: davidescobar at ieee.org (David Escobar) Date: Sat, 30 Apr 2016 00:04:09 -0700 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: References: Message-ID: Thanks Yuri. It's not the case this time, but I've run into this issue in the past, particularly when running Linux in a VM and the VM goes to sleep - sometimes the clock goes out of sync. On Fri, Apr 29, 2016 at 8:20 AM, Yuri de Wit wrote: > Also, make sure the time on the machine you are running this client didn't > drift too far from the server's time. If this delta crosses a threshold, > you will see similar issues. > > On Fri, Apr 29, 2016 at 11:07 AM, David Johnson > wrote: > >> I think that package is using an outdated version of the AWS Signing >> algorithm. >> >> "AWS3-HTTPS" >> I think AWS is migrating most of their APIs (who have domains / services created after a certain date) to require using the V4 Signature algorithm for all API requests. >> >> The amazonka-ses would probably work better. >> >> >> On Fri, Apr 29, 2016 at 1:45 AM, David Escobar >> wrote: >> >>> Hi everyone, >>> I'm having issues with sending email through Amazon SES. I'm using the >>> *Network.Mail.Mime.SES* package. The error I get is: >>> >>> *email-test-exe: SESException {seStatus = Status {statusCode = 403, >>> statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage = >>> "The request signature we calculated does not match the signature you >>> provided. Check your AWS Secret Access Key and signing method. Consult the >>> service documentation for details.", seRequestId = >>> "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* >>> >>> What's confusing is that I'm using the same SES settings in a Rails app >>> as well as a small Rust console program without any issues (it works from >>> the same machine too). The only thing I can think of is that with this >>> Haskell package, I haven't found where to set certain things like the port >>> number (587) and so maybe it's that? Here is a small sample app that >>> illustrates the problem. What am I missing? Thanks. >>> >>> >>> >>> *{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE QuasiQuotes #-}* >>> *module Main where* >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> *import Data.Function ((&))import GHC.Genericsimport >>> Network.HTTP.Clientimport Network.HTTP.Client.TLSimport >>> Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet >>> (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import >>> qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport >>> qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager >>> tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack >>> "de at somewhere.com ", sesTo = [ >>> C8.pack "someone.else at somewhereelse.com " >>> ], sesAccessKey = "SOMEAWSACCESSKEY", >>> sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", >>> sesRegion = usEast1 } email = Mail { mailFrom = Address (Just >>> "David Escobar") "de at somewhere.com ", >>> mailTo = [ Address (Just "Someone Else") "someone.else at somewhereelse.com >>> " ], mailParts = [ [ >>> htmlPart testEmail ] ], mailCc = [], >>> mailBcc = [], mailHeaders = [ ("subject", "Some Test >>> Email"), ("Content-Type", "text/html; >>> charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig >>> emailtestEmail :: LT.TexttestEmail = let rows = [ [ "1", "2", "3" ], [ >>> "4", "5", "6" ]] in renderHtml [shamlet| $doctype 5 >>> >> style="background-color: #f8f9ee;">
>> style="background-color: #072a2d; color: white; font-weight: bold; >>> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >>> Column 1 Column 2 >> style="background-color: #072a2d; color: white; font-weight: bold; >>> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >>> Column 3 $forall row <- rows
>>> #{T.pack $ row !! 0} >>> #{T.pack $ row !! 1} >>> #{T.pack $ row !! 2} |] & LT.pack* >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> >> >> -- >> Cell: 1.630.740.8204 >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Sat Apr 30 07:10:52 2016 From: davidescobar at ieee.org (David Escobar) Date: Sat, 30 Apr 2016 00:10:52 -0700 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: References: Message-ID: David, thanks for the suggestion. Are there any examples on how to send an email? I've looked through several of the Haskell email packages and have been able to figure out their APIs easily enough, but this one seems incredibly complex - almost seem to have to know the internals of SES to use it effectively and the documentation / examples are scant. On Fri, Apr 29, 2016 at 7:07 AM, David Johnson wrote: > I think that package is using an outdated version of the AWS Signing > algorithm. > > "AWS3-HTTPS" > I think AWS is migrating most of their APIs (who have domains / services created after a certain date) to require using the V4 Signature algorithm for all API requests. > > The amazonka-ses would probably work better. > > > On Fri, Apr 29, 2016 at 1:45 AM, David Escobar > wrote: > >> Hi everyone, >> I'm having issues with sending email through Amazon SES. I'm using the >> *Network.Mail.Mime.SES* package. The error I get is: >> >> *email-test-exe: SESException {seStatus = Status {statusCode = 403, >> statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage = >> "The request signature we calculated does not match the signature you >> provided. Check your AWS Secret Access Key and signing method. Consult the >> service documentation for details.", seRequestId = >> "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* >> >> What's confusing is that I'm using the same SES settings in a Rails app >> as well as a small Rust console program without any issues (it works from >> the same machine too). The only thing I can think of is that with this >> Haskell package, I haven't found where to set certain things like the port >> number (587) and so maybe it's that? Here is a small sample app that >> illustrates the problem. What am I missing? Thanks. >> >> >> >> *{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE QuasiQuotes #-}* >> *module Main where* >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *import Data.Function ((&))import GHC.Genericsimport >> Network.HTTP.Clientimport Network.HTTP.Client.TLSimport >> Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet >> (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import >> qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport >> qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager >> tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack >> "de at somewhere.com ", sesTo = [ >> C8.pack "someone.else at somewhereelse.com " >> ], sesAccessKey = "SOMEAWSACCESSKEY", >> sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", >> sesRegion = usEast1 } email = Mail { mailFrom = Address (Just >> "David Escobar") "de at somewhere.com ", >> mailTo = [ Address (Just "Someone Else") "someone.else at somewhereelse.com >> " ], mailParts = [ [ >> htmlPart testEmail ] ], mailCc = [], >> mailBcc = [], mailHeaders = [ ("subject", "Some Test >> Email"), ("Content-Type", "text/html; >> charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig >> emailtestEmail :: LT.TexttestEmail = let rows = [ [ "1", "2", "3" ], [ >> "4", "5", "6" ]] in renderHtml [shamlet| $doctype 5 >> > style="background-color: #f8f9ee;">
> style="background-color: #072a2d; color: white; font-weight: bold; >> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >> Column 1 Column 2 > style="background-color: #072a2d; color: white; font-weight: bold; >> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >> Column 3 $forall row <- rows
>> #{T.pack $ row !! 0} >> #{T.pack $ row !! 1} >> #{T.pack $ row !! 2} |] & LT.pack* >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > > > -- > Cell: 1.630.740.8204 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vlatko.basic at gmail.com Sat Apr 30 07:39:08 2016 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Sat, 30 Apr 2016 09:39:08 +0200 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: References: Message-ID: Hi David, I'm using almost exact function as you wrote below and it works without problems. Using mime-mail-ses-0.3.2.2. However, it works on E2 instance. Don't know if that matters. Stupid question, but have you double checked keys? I received similar errors when keys were not correct (they were not hardcoded, but fetched). br, vlatko > -------- Original Message -------- > Subject: Re: [Haskell-cafe] Amazon SES email issues > From: David Escobar > To: David Johnson > Cc: Haskell Cafe > Date: 30/04/16 09:10 > > > David, thanks for the suggestion. Are there any examples on how to send an > email? I've looked through several of the Haskell email packages and have been > able to figure out their APIs easily enough, but this one seems incredibly > complex - almost seem to have to know the internals of SES to use it > effectively and the documentation / examples are scant. > > On Fri, Apr 29, 2016 at 7:07 AM, David Johnson > wrote: > > I think that package is using an outdated version of the AWS Signing > algorithm. > > "AWS3-HTTPS" I think AWS is migrating most of their APIs (who have domains > / services created after a certain date) to require using the V4 Signature > algorithm for all API requests. The amazonka-ses would probably work better. > > > On Fri, Apr 29, 2016 at 1:45 AM, David Escobar > wrote: > > Hi everyone, > I'm having issues with sending email through Amazon SES. I'm using the > *Network.Mail.Mime.SES* package. The error I get is: > > *email-test-exe: SESException {seStatus = Status {statusCode = 403, > statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", > seMessage = "The request signature we calculated does not match the > signature you provided. Check your AWS Secret Access Key and signing > method. Consult the service documentation for details.", seRequestId = > "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* > > What's confusing is that I'm using the same SES settings in a Rails > app as well as a small Rust console program without any issues (it > works from the same machine too). The only thing I can think of is > that with this Haskell package, I haven't found where to set certain > things like the port number (587) and so maybe it's that? Here is a > small sample app that illustrates the problem. What am I missing? Thanks. > > > *{-# LANGUAGE OverloadedStrings #-} > {-# LANGUAGE QuasiQuotes #-}* > > *module Main where* > * > import Data.Function ((&)) > import GHC.Generics > import Network.HTTP.Client > import Network.HTTP.Client.TLS > import Network.Mail.Mime > import Network.Mail.Mime.SES > import Text.Hamlet (shamlet) > import Text.Blaze.Html.Renderer.String (renderHtml) > > import qualified Data.ByteString.Char8 as C8 > import qualified Data.Text as T > import qualified Data.Text.Lazy as LT > > main :: IO () > main = do > manager <- newManager tlsManagerSettings > let sesConfig = SES { sesFrom = C8.pack "de at somewhere.com > ", > sesTo = [ C8.pack > "someone.else at somewhereelse.com > " ], > sesAccessKey = "SOMEAWSACCESSKEY", > sesSecretKey = > "ANEVENLONGERAWSSECRETKEY1234567890", > sesRegion = usEast1 } > email = Mail { mailFrom = Address (Just "David Escobar") > "de at somewhere.com ", > mailTo = [ Address (Just "Someone Else") > "someone.else at somewhereelse.com > " ], > mailParts = [ [ htmlPart testEmail ] ], > mailCc = [], > mailBcc = [], > mailHeaders = [ ("subject", "Some Test Email"), > ("Content-Type", "text/html; charset=ISO-8859-1") ] } > renderSendMailSES manager sesConfig email > > > testEmail :: LT.Text > testEmail = > let rows = [ [ "1", "2", "3" ], [ "4", "5", "6" ]] > in > renderHtml [shamlet| > $doctype 5 > > > > > >
> Column 1 > > Column 2 > > Column 3 > $forall row <- rows >
> #{T.pack $ row !! 0} > > #{T.pack $ row !! 1} > > #{T.pack $ row !! 2} > |] & LT.pack* > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > > > -- > Cell: 1.630.740.8204 > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From brendan.g.hay at gmail.com Sat Apr 30 07:59:23 2016 From: brendan.g.hay at gmail.com (Brendan Hay) Date: Sat, 30 Apr 2016 09:59:23 +0200 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: References: Message-ID: No examples for amazonka-ses yet unfortunately. There are brief examples in the source repository for other services: https://github.com/brendanhay/amazonka/tree/develop/examples/src/Example I'll add something for SES shortly. The amazonka-* library operations and types map directly to the AWS documentation - so you will need to a) have an understanding of the product/service offering b) be willing to reference the relevant AWS documentation. Each amazonka-* library can be considered a 'low level' interface to the related Amazon service, with a unified AuthN/AuthZ (newEnv) and request/response (send) interface available in the main 'amazonka' library. For your example above, as the older AWS APIs tend to have fairly unhelpful error messages - your only option unfortunately is trial and error. The keys are naturally the first thing to check, make sure you haven't mixed up the access and secret keys by accident and that they are in fact the same keys being used by your equivalent Rust program. Just for clarification - you mentioned port 587, are you attempting to communicate with a non-standard endpoint? On 30 April 2016 at 09:10, David Escobar wrote: > David, thanks for the suggestion. Are there any examples on how to send an > email? I've looked through several of the Haskell email packages and have > been able to figure out their APIs easily enough, but this one seems > incredibly complex - almost seem to have to know the internals of SES to > use it effectively and the documentation / examples are scant. > > On Fri, Apr 29, 2016 at 7:07 AM, David Johnson > wrote: > >> I think that package is using an outdated version of the AWS Signing >> algorithm. >> >> "AWS3-HTTPS" >> I think AWS is migrating most of their APIs (who have domains / services created after a certain date) to require using the V4 Signature algorithm for all API requests. >> >> The amazonka-ses would probably work better. >> >> >> On Fri, Apr 29, 2016 at 1:45 AM, David Escobar >> wrote: >> >>> Hi everyone, >>> I'm having issues with sending email through Amazon SES. I'm using the >>> *Network.Mail.Mime.SES* package. The error I get is: >>> >>> *email-test-exe: SESException {seStatus = Status {statusCode = 403, >>> statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage = >>> "The request signature we calculated does not match the signature you >>> provided. Check your AWS Secret Access Key and signing method. Consult the >>> service documentation for details.", seRequestId = >>> "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* >>> >>> What's confusing is that I'm using the same SES settings in a Rails app >>> as well as a small Rust console program without any issues (it works from >>> the same machine too). The only thing I can think of is that with this >>> Haskell package, I haven't found where to set certain things like the port >>> number (587) and so maybe it's that? Here is a small sample app that >>> illustrates the problem. What am I missing? Thanks. >>> >>> >>> >>> *{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE QuasiQuotes #-}* >>> *module Main where* >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> *import Data.Function ((&))import GHC.Genericsimport >>> Network.HTTP.Clientimport Network.HTTP.Client.TLSimport >>> Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet >>> (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import >>> qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport >>> qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager >>> tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack >>> "de at somewhere.com ", sesTo = [ >>> C8.pack "someone.else at somewhereelse.com " >>> ], sesAccessKey = "SOMEAWSACCESSKEY", >>> sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", >>> sesRegion = usEast1 } email = Mail { mailFrom = Address (Just >>> "David Escobar") "de at somewhere.com ", >>> mailTo = [ Address (Just "Someone Else") "someone.else at somewhereelse.com >>> " ], mailParts = [ [ >>> htmlPart testEmail ] ], mailCc = [], >>> mailBcc = [], mailHeaders = [ ("subject", "Some Test >>> Email"), ("Content-Type", "text/html; >>> charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig >>> emailtestEmail :: LT.TexttestEmail = let rows = [ [ "1", "2", "3" ], [ >>> "4", "5", "6" ]] in renderHtml [shamlet| $doctype 5 >>> >> style="background-color: #f8f9ee;">
>> style="background-color: #072a2d; color: white; font-weight: bold; >>> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >>> Column 1 Column 2 >> style="background-color: #072a2d; color: white; font-weight: bold; >>> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >>> Column 3 $forall row <- rows
>>> #{T.pack $ row !! 0} >>> #{T.pack $ row !! 1} >>> #{T.pack $ row !! 2} |] & LT.pack* >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> >> >> -- >> Cell: 1.630.740.8204 >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Sat Apr 30 08:18:22 2016 From: davidescobar at ieee.org (David Escobar) Date: Sat, 30 Apr 2016 01:18:22 -0700 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: References: Message-ID: Hi Brendan. Yes, I use port 587 in my other apps and it's worked fine there. When using Network.Mail.Mime.SES, I haven't found a place to explicitly set it though. Perhaps it assumes 587 by default? I've also used the same keys but no success there. I tried flipping them around, and got an authentication error, so I know the original order was correct. The only other thing I'm doing in my Rust program is setting the authentication mechanism to PLAIN and there's also an option to always encrypt which I've set as well. There doesn't seem to be an exact equivalent set of options in Network.Mail.Mime.SES, but perhaps it also does those by default? On Sat, Apr 30, 2016 at 12:59 AM, Brendan Hay wrote: > No examples for amazonka-ses yet unfortunately. There are brief examples > in the source repository for other services: > https://github.com/brendanhay/amazonka/tree/develop/examples/src/Example > I'll add something for SES shortly. > > The amazonka-* library operations and types map directly to the AWS > documentation - so you will need to a) have an understanding of the > product/service offering b) be willing to reference the relevant AWS > documentation. > Each amazonka-* library can be considered a 'low level' interface to the > related Amazon service, with a unified AuthN/AuthZ (newEnv) and > request/response (send) interface available in the main 'amazonka' library. > > For your example above, as the older AWS APIs tend to have fairly > unhelpful error messages - your only option unfortunately is trial and > error. The keys are naturally the first thing to check, make sure you > haven't mixed up the access and secret keys by accident and that they are > in fact the same keys being used by your equivalent Rust program. > > Just for clarification - you mentioned port 587, are you attempting to > communicate with a non-standard endpoint? > > On 30 April 2016 at 09:10, David Escobar wrote: > >> David, thanks for the suggestion. Are there any examples on how to send >> an email? I've looked through several of the Haskell email packages and >> have been able to figure out their APIs easily enough, but this one seems >> incredibly complex - almost seem to have to know the internals of SES to >> use it effectively and the documentation / examples are scant. >> >> On Fri, Apr 29, 2016 at 7:07 AM, David Johnson >> wrote: >> >>> I think that package is using an outdated version of the AWS Signing >>> algorithm. >>> >>> "AWS3-HTTPS" >>> I think AWS is migrating most of their APIs (who have domains / services created after a certain date) to require using the V4 Signature algorithm for all API requests. >>> >>> The amazonka-ses would probably work better. >>> >>> >>> On Fri, Apr 29, 2016 at 1:45 AM, David Escobar >>> wrote: >>> >>>> Hi everyone, >>>> I'm having issues with sending email through Amazon SES. I'm using the >>>> *Network.Mail.Mime.SES* package. The error I get is: >>>> >>>> *email-test-exe: SESException {seStatus = Status {statusCode = 403, >>>> statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage = >>>> "The request signature we calculated does not match the signature you >>>> provided. Check your AWS Secret Access Key and signing method. Consult the >>>> service documentation for details.", seRequestId = >>>> "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* >>>> >>>> What's confusing is that I'm using the same SES settings in a Rails app >>>> as well as a small Rust console program without any issues (it works from >>>> the same machine too). The only thing I can think of is that with this >>>> Haskell package, I haven't found where to set certain things like the port >>>> number (587) and so maybe it's that? Here is a small sample app that >>>> illustrates the problem. What am I missing? Thanks. >>>> >>>> >>>> >>>> *{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE QuasiQuotes #-}* >>>> *module Main where* >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> *import Data.Function ((&))import GHC.Genericsimport >>>> Network.HTTP.Clientimport Network.HTTP.Client.TLSimport >>>> Network.Mail.Mimeimport Network.Mail.Mime.SESimport Text.Hamlet >>>> (shamlet)import Text.Blaze.Html.Renderer.String (renderHtml)import >>>> qualified Data.ByteString.Char8 as C8import qualified Data.Text as Timport >>>> qualified Data.Text.Lazy as LTmain :: IO ()main = do manager <- newManager >>>> tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack >>>> "de at somewhere.com ", sesTo = [ >>>> C8.pack "someone.else at somewhereelse.com " >>>> ], sesAccessKey = "SOMEAWSACCESSKEY", >>>> sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", >>>> sesRegion = usEast1 } email = Mail { mailFrom = Address (Just >>>> "David Escobar") "de at somewhere.com ", >>>> mailTo = [ Address (Just "Someone Else") "someone.else at somewhereelse.com >>>> " ], mailParts = [ [ >>>> htmlPart testEmail ] ], mailCc = [], >>>> mailBcc = [], mailHeaders = [ ("subject", "Some Test >>>> Email"), ("Content-Type", "text/html; >>>> charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig >>>> emailtestEmail :: LT.TexttestEmail = let rows = [ [ "1", "2", "3" ], [ >>>> "4", "5", "6" ]] in renderHtml [shamlet| $doctype 5 >>>> >>> style="background-color: #f8f9ee;">
>>> style="background-color: #072a2d; color: white; font-weight: bold; >>>> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >>>> Column 1 Column 2 >>> style="background-color: #072a2d; color: white; font-weight: bold; >>>> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >>>> Column 3 $forall row <- rows
>>>> #{T.pack $ row !! 0} >>>> #{T.pack $ row !! 1} >>>> #{T.pack $ row !! 2} |] & LT.pack* >>>> >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>>> >>> >>> >>> -- >>> Cell: 1.630.740.8204 >>> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Sat Apr 30 08:31:42 2016 From: davidescobar at ieee.org (David Escobar) Date: Sat, 30 Apr 2016 01:31:42 -0700 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: References: Message-ID: Hi Vlatko, Yes, I've double checked the keys. I'm using the same ones in a Rails app as well as a small Rust CLI program and they both work (on the same machine too). So it's definitely something I'm missing on the Haskell side. I checked my package versions, and I have: mime-mail 0.4.11 mime-mail-ses 0.3.2.2 mime-types 0.1.0.6 So it looks like we're using the same versions. I'm not sure about the E2 instance. I'll have to check with my DevOps colleague at work to make sure. If it's still SES email, I would imagine that it shouldn't matter, especially since both the Ruby (ActionMailer) and Rust (lettre) email libraries I'm using are general email libraries and not SES-specific and they both work fine, but at this point, who knows? I've tried everything else without success, but the fact that you're using it ok tells me I'm probably close and just missing a small detail or so. Kind of surprised how difficult it's been actually. I was expecting the Rust library to be the one that gave me problems. :) On Sat, Apr 30, 2016 at 12:39 AM, Vlatko Basic wrote: > Hi David, > > I'm using almost exact function as you wrote below and it works without > problems. Using mime-mail-ses-0.3.2.2. > > However, it works on E2 instance. Don't know if that matters. > > Stupid question, but have you double checked keys? > > I received similar errors when keys were not correct (they were not > hardcoded, but fetched). > > > br, > > vlatko > > -------- Original Message -------- > Subject: Re: [Haskell-cafe] Amazon SES email issues > From: David Escobar > To: David Johnson > Cc: Haskell Cafe > Date: 30/04/16 09:10 > > > David, thanks for the suggestion. Are there any examples on how to send an > email? I've looked through several of the Haskell email packages and have > been able to figure out their APIs easily enough, but this one seems > incredibly complex - almost seem to have to know the internals of SES to > use it effectively and the documentation / examples are scant. > > On Fri, Apr 29, 2016 at 7:07 AM, David Johnson > wrote: > >> I think that package is using an outdated version of the AWS Signing >> algorithm. >> >> "AWS3-HTTPS" >> I think AWS is migrating most of their APIs (who have domains / services created after a certain date) to require using the V4 Signature algorithm for all API requests. >> >> The amazonka-ses would probably work better. >> >> >> On Fri, Apr 29, 2016 at 1:45 AM, David Escobar < >> davidescobar at ieee.org> wrote: >> >>> Hi everyone, >>> I'm having issues with sending email through Amazon SES. I'm using the >>> *Network.Mail.Mime.SES* package. The error I get is: >>> >>> *email-test-exe: SESException {seStatus = Status {statusCode = 403, >>> statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage = >>> "The request signature we calculated does not match the signature you >>> provided. Check your AWS Secret Access Key and signing method. Consult the >>> service documentation for details.", seRequestId = >>> "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* >>> >>> What's confusing is that I'm using the same SES settings in a Rails app >>> as well as a small Rust console program without any issues (it works from >>> the same machine too). The only thing I can think of is that with this >>> Haskell package, I haven't found where to set certain things like the port >>> number (587) and so maybe it's that? Here is a small sample app that >>> illustrates the problem. What am I missing? Thanks. >>> >>> >>> >>> *{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}* >>> *module Main where* >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> * import Data.Function ((&)) import GHC.Generics import >>> Network.HTTP.Client import Network.HTTP.Client.TLS import Network.Mail.Mime >>> import Network.Mail.Mime.SES import Text.Hamlet (shamlet) import >>> Text.Blaze.Html.Renderer.String (renderHtml) import qualified >>> Data.ByteString.Char8 as C8 import qualified Data.Text as T import >>> qualified Data.Text.Lazy as LT main :: IO () main = do manager <- >>> newManager tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack >>> "de at somewhere.com ", sesTo = [ >>> C8.pack "someone.else at somewhereelse.com " >>> ], sesAccessKey = "SOMEAWSACCESSKEY", >>> sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", >>> sesRegion = usEast1 } email = Mail { mailFrom = Address >>> (Just "David Escobar") " de at somewhere.com >>> ", mailTo = [ Address (Just "Someone >>> Else") " someone.else at somewhereelse.com >>> " ], mailParts = [ [ >>> htmlPart testEmail ] ], mailCc = [], >>> mailBcc = [], mailHeaders = [ ("subject", "Some >>> Test Email"), ("Content-Type", >>> "text/html; charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig >>> email testEmail :: LT.Text testEmail = let rows = [ [ "1", "2", "3" ], [ >>> "4", "5", "6" ]] in renderHtml [shamlet| $doctype 5 >>> >>> >> style="background-color: #f8f9ee;">
Column 1 Column 2 >> style="background-color: #072a2d; color: white; font-weight: bold; >>> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >>> Column 3 $forall row <- rows
>>> #{T.pack $ row !! 0} >>> #{T.pack $ row !! 1} >>> #{T.pack $ row !! 2} |] & LT.pack* >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >>> >> >> >> -- >> Cell: 1.630.740.8204 >> > > > > _______________________________________________ > Haskell-Cafe mailing listHaskell-Cafe at haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vlatko.basic at gmail.com Sat Apr 30 08:48:40 2016 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Sat, 30 Apr 2016 10:48:40 +0200 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: References: Message-ID: <1c8ca976-d01b-94cd-adaf-b64c9bf35b77@gmail.com> Hi, Just saw a note in my code about one more thing. Actually very important. The From: email address, "*sesFrom = C8.pack "de at somewhere.com "*", has to be verified at Amazon. For "sesFrom" you can't use any email address, but can in "mailFrom". Since your Ruby and Rust code are not SES-specific, maybe you can try a more general library, like Network.HaskellNet.SMTP. I'm using it for local SMTP, but haven't tried it with SES. If you'll try it and have success, let us know. br, vlatko > -------- Original Message -------- > Subject: Re: [Haskell-cafe] Amazon SES email issues > From: David Escobar > To: vlatko.basic at gmail.com, Haskell Cafe > Date: 30/04/16 10:31 > > > Hi Vlatko, > Yes, I've double checked the keys. I'm using the same ones in a Rails app as > well as a small Rust CLI program and they both work (on the same machine too). > So it's definitely something I'm missing on the Haskell side. > > I checked my package versions, and I have: > mime-mail 0.4.11 > mime-mail-ses 0.3.2.2 > mime-types 0.1.0.6 > > So it looks like we're using the same versions. I'm not sure about the E2 > instance. I'll have to check with my DevOps colleague at work to make sure. If > it's still SES email, I would imagine that it shouldn't matter, especially > since both the Ruby (ActionMailer) and Rust (lettre) email libraries I'm using > are general email libraries and not SES-specific and they both work fine, but > at this point, who knows? I've tried everything else without success, but the > fact that you're using it ok tells me I'm probably close and just missing a > small detail or so. > > Kind of surprised how difficult it's been actually. I was expecting the Rust > library to be the one that gave me problems. :) > > On Sat, Apr 30, 2016 at 12:39 AM, Vlatko Basic > wrote: > > Hi David, > > I'm using almost exact function as you wrote below and it works without > problems. Using mime-mail-ses-0.3.2.2. > > However, it works on E2 instance. Don't know if that matters. > > Stupid question, but have you double checked keys? > > I received similar errors when keys were not correct (they were not > hardcoded, but fetched). > > > br, > > vlatko > > >> -------- Original Message -------- >> Subject: Re: [Haskell-cafe] Amazon SES email issues >> From: David Escobar >> To: David Johnson >> Cc: Haskell Cafe >> Date: 30/04/16 09:10 >> >> >> David, thanks for the suggestion. Are there any examples on how to send >> an email? I've looked through several of the Haskell email packages and >> have been able to figure out their APIs easily enough, but this one seems >> incredibly complex - almost seem to have to know the internals of SES to >> use it effectively and the documentation / examples are scant. >> >> On Fri, Apr 29, 2016 at 7:07 AM, David Johnson > > wrote: >> >> I think that package is using an outdated version of the AWS Signing >> algorithm. >> >> "AWS3-HTTPS" I think AWS is migrating most of their APIs (who have >> domains / services created after a certain date) to require using the >> V4 Signature algorithm for all API requests. The amazonka-ses would >> probably work better. >> >> >> On Fri, Apr 29, 2016 at 1:45 AM, David Escobar > > wrote: >> >> Hi everyone, >> I'm having issues with sending email through Amazon SES. I'm >> using the *Network.Mail.Mime.SES* package. The error I get is: >> >> *email-test-exe: SESException {seStatus = Status {statusCode = >> 403, statusMessage = "Forbidden"}, seCode = >> "SignatureDoesNotMatch", seMessage = "The request signature we >> calculated does not match the signature you provided. Check your >> AWS Secret Access Key and signing method. Consult the service >> documentation for details.", seRequestId = >> "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* >> >> What's confusing is that I'm using the same SES settings in a >> Rails app as well as a small Rust console program without any >> issues (it works from the same machine too). The only thing I can >> think of is that with this Haskell package, I haven't found where >> to set certain things like the port number (587) and so maybe >> it's that? Here is a small sample app that illustrates the >> problem. What am I missing? Thanks. >> >> >> *{-# LANGUAGE OverloadedStrings #-} >> {-# LANGUAGE QuasiQuotes #-}* >> >> *module Main where* >> * >> import Data.Function ((&)) >> import GHC.Generics >> import Network.HTTP.Client >> import Network.HTTP.Client.TLS >> import Network.Mail.Mime >> import Network.Mail.Mime.SES >> import Text.Hamlet (shamlet) >> import Text.Blaze.Html.Renderer.String (renderHtml) >> >> import qualified Data.ByteString.Char8 as C8 >> import qualified Data.Text as T >> import qualified Data.Text.Lazy as LT >> >> main :: IO () >> main = do >> manager <- newManager tlsManagerSettings >> let sesConfig = SES { sesFrom = C8.pack "de at somewhere.com >> ", >> sesTo = [ C8.pack "someone.else at somewhereelse.com >> " ], >> sesAccessKey = "SOMEAWSACCESSKEY", >> sesSecretKey = "ANEVENLONGERAWSSECRETKEY1234567890", >> sesRegion = usEast1 } >> email = Mail { mailFrom = Address (Just "David Escobar") >> "de at somewhere.com ", >> mailTo = [ Address (Just "Someone Else") >> "someone.else at somewhereelse.com >> " ], >> mailParts = [ [ htmlPart testEmail ] ], >> mailCc = [], >> mailBcc = [], >> mailHeaders = [ ("subject", "Some Test Email"), >> ("Content-Type", "text/html; charset=ISO-8859-1") ] } >> renderSendMailSES manager sesConfig email >> >> >> testEmail :: LT.Text >> testEmail = >> let rows = [ [ "1", "2", "3" ], [ "4", "5", "6" ]] >> in >> renderHtml [shamlet| >> $doctype 5 >> >> >> >> >> >>
>> Column 1 >> >> Column 2 >> >> Column 3 >> $forall row <- rows >>
>> #{T.pack $ row !! 0} >> >> #{T.pack $ row !! 1} >> >> #{T.pack $ row !! 2} >> |] & LT.pack* >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> >> >> -- >> Cell: 1.630.740.8204 >> >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From imantc at gmail.com Sat Apr 30 08:54:30 2016 From: imantc at gmail.com (Imants Cekusins) Date: Sat, 30 Apr 2016 10:54:30 +0200 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: <1c8ca976-d01b-94cd-adaf-b64c9bf35b77@gmail.com> References: <1c8ca976-d01b-94cd-adaf-b64c9bf35b77@gmail.com> Message-ID: are Amazon client API libraries (java, ...) - an option? ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidescobar at ieee.org Sat Apr 30 09:13:44 2016 From: davidescobar at ieee.org (David Escobar) Date: Sat, 30 Apr 2016 02:13:44 -0700 Subject: [Haskell-cafe] Amazon SES email issues In-Reply-To: <1c8ca976-d01b-94cd-adaf-b64c9bf35b77@gmail.com> References: <1c8ca976-d01b-94cd-adaf-b64c9bf35b77@gmail.com> Message-ID: Yes, there's another thread from last week, where I was using Network.HaskellNet.SMTP (and Network.HaskellNet.SMTP.SSL). It worked great when using a Gmail account, and I was also able to send emails using SES, however, with the SES version, it mangled the HTML and CSS in weird ways by inserting line breaks and carriage returns in odd places, which basically destroyed the formatting of the email. I'd never seen that happen before with other libraries. That's when someone suggested I look at Network.Mime.Mail.SES. But yeah, the verified email address might be the issue. I'll check with DevOps on that as well. Thanks! On Sat, Apr 30, 2016 at 1:48 AM, Vlatko Basic wrote: > Hi, > > Just saw a note in my code about one more thing. Actually very important. > > The From: email address, "*sesFrom = C8.pack "de at somewhere.com > "*", has to be verified at Amazon. > > For "sesFrom" you can't use any email address, but can in "mailFrom". > > > Since your Ruby and Rust code are not SES-specific, maybe you can try a > more general library, like Network.HaskellNet.SMTP. > > I'm using it for local SMTP, but haven't tried it with SES. > > If you'll try it and have success, let us know. > > > br, > > vlatko > > > -------- Original Message -------- > Subject: Re: [Haskell-cafe] Amazon SES email issues > From: David Escobar > To: vlatko.basic at gmail.com, Haskell Cafe > > Date: 30/04/16 10:31 > > > Hi Vlatko, > Yes, I've double checked the keys. I'm using the same ones in a Rails app > as well as a small Rust CLI program and they both work (on the same machine > too). So it's definitely something I'm missing on the Haskell side. > > I checked my package versions, and I have: > mime-mail 0.4.11 > mime-mail-ses 0.3.2.2 > mime-types 0.1.0.6 > > So it looks like we're using the same versions. I'm not sure about the E2 > instance. I'll have to check with my DevOps colleague at work to make sure. > If it's still SES email, I would imagine that it shouldn't matter, > especially since both the Ruby (ActionMailer) and Rust (lettre) email > libraries I'm using are general email libraries and not SES-specific and > they both work fine, but at this point, who knows? I've tried everything > else without success, but the fact that you're using it ok tells me I'm > probably close and just missing a small detail or so. > > Kind of surprised how difficult it's been actually. I was expecting the > Rust library to be the one that gave me problems. :) > > On Sat, Apr 30, 2016 at 12:39 AM, Vlatko Basic > wrote: > >> Hi David, >> >> I'm using almost exact function as you wrote below and it works without >> problems. Using mime-mail-ses-0.3.2.2. >> >> However, it works on E2 instance. Don't know if that matters. >> >> Stupid question, but have you double checked keys? >> >> I received similar errors when keys were not correct (they were not >> hardcoded, but fetched). >> >> >> br, >> >> vlatko >> >> -------- Original Message -------- >> Subject: Re: [Haskell-cafe] Amazon SES email issues >> From: David Escobar >> To: David Johnson >> Cc: Haskell Cafe >> Date: 30/04/16 09:10 >> >> >> David, thanks for the suggestion. Are there any examples on how to send >> an email? I've looked through several of the Haskell email packages and >> have been able to figure out their APIs easily enough, but this one seems >> incredibly complex - almost seem to have to know the internals of SES to >> use it effectively and the documentation / examples are scant. >> >> On Fri, Apr 29, 2016 at 7:07 AM, David Johnson < >> djohnson.m at gmail.com> wrote: >> >>> I think that package is using an outdated version of the AWS Signing >>> algorithm. >>> >>> "AWS3-HTTPS" >>> I think AWS is migrating most of their APIs (who have domains / services created after a certain date) to require using the V4 Signature algorithm for all API requests. >>> >>> The amazonka-ses would probably work better. >>> >>> >>> On Fri, Apr 29, 2016 at 1:45 AM, David Escobar < >>> davidescobar at ieee.org> wrote: >>> >>>> Hi everyone, >>>> I'm having issues with sending email through Amazon SES. I'm using the >>>> *Network.Mail.Mime.SES* package. The error I get is: >>>> >>>> *email-test-exe: SESException {seStatus = Status {statusCode = 403, >>>> statusMessage = "Forbidden"}, seCode = "SignatureDoesNotMatch", seMessage = >>>> "The request signature we calculated does not match the signature you >>>> provided. Check your AWS Secret Access Key and signing method. Consult the >>>> service documentation for details.", seRequestId = >>>> "8ceb250a-0dd3-11e6-892c-4fb1a14d4732"}* >>>> >>>> What's confusing is that I'm using the same SES settings in a Rails app >>>> as well as a small Rust console program without any issues (it works from >>>> the same machine too). The only thing I can think of is that with this >>>> Haskell package, I haven't found where to set certain things like the port >>>> number (587) and so maybe it's that? Here is a small sample app that >>>> illustrates the problem. What am I missing? Thanks. >>>> >>>> >>>> >>>> *{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-}* >>>> *module Main where* >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> * import Data.Function ((&)) import GHC.Generics import >>>> Network.HTTP.Client import Network.HTTP.Client.TLS import Network.Mail.Mime >>>> import Network.Mail.Mime.SES import Text.Hamlet (shamlet) import >>>> Text.Blaze.Html.Renderer.String (renderHtml) import qualified >>>> Data.ByteString.Char8 as C8 import qualified Data.Text as T import >>>> qualified Data.Text.Lazy as LT main :: IO () main = do manager <- >>>> newManager tlsManagerSettings let sesConfig = SES { sesFrom = C8.pack " >>>> de at somewhere.com ", >>>> sesTo = [ C8.pack " >>>> someone.else at somewhereelse.com >>>> " ], sesAccessKey = >>>> "SOMEAWSACCESSKEY", sesSecretKey = >>>> "ANEVENLONGERAWSSECRETKEY1234567890", sesRegion = >>>> usEast1 } email = Mail { mailFrom = Address (Just "David Escobar") " >>>> de at somewhere.com ", >>>> mailTo = [ Address (Just "Someone Else") " >>>> someone.else at somewhereelse.com >>>> " ], mailParts = [ [ >>>> htmlPart testEmail ] ], mailCc = [], >>>> mailBcc = [], mailHeaders = [ ("subject", "Some >>>> Test Email"), ("Content-Type", >>>> "text/html; charset=ISO-8859-1") ] } renderSendMailSES manager sesConfig >>>> email testEmail :: LT.Text testEmail = let rows = [ [ "1", "2", "3" ], [ >>>> "4", "5", "6" ]] in renderHtml [shamlet| $doctype 5 >>>> >>>> >>> style="background-color: #f8f9ee;">
Column 1 Column 2 >>> style="background-color: #072a2d; color: white; font-weight: bold; >>>> border-right: 1px solid white; padding: 5px 10px; width: 33%;"> >>>> Column 3 $forall row <- rows
>>>> #{T.pack $ row !! 0} >>>> #{T.pack $ row !! 1} >>>> #{T.pack $ row !! 2} |] & LT.pack* >>>> >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> >>>> >>> >>> >>> -- >>> Cell: 1.630.740.8204 >>> >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing listHaskell-Cafe at haskell.orghttp://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sat Apr 30 12:34:56 2016 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sat, 30 Apr 2016 08:34:56 -0400 Subject: [Haskell-cafe] cannot perform arithmetic with GHC.TypeLits? In-Reply-To: References: Message-ID: Use the type lits Nat solver plugin by Christian B, or a userland peano encoding. Sadly ghc does have any builtin equational theory so you either need to construct proofs yourself or use a plugin. I'm personally doing the plugin approach. If you would like to construct the proofs by hand I'll dig up some examples later today if you like. On Saturday, April 30, 2016, Baojun Wang wrote: > Hi List, > > When I try to build below program, the compiler complains > > Couldn't match type ?n? with ?1 + (n - 1)? ? > > Why GHC (7.10.3) cannot do type level natural number arithmetic? `` n /= > 1 + (n-1)`` at type level? > > -- | main.hs > {-# LANGUAGE ScopedTypeVariables #-} > {-# LANGUAGE FlexibleInstances #-} > {-# LANGUAGE GADTs #-} > {-# LANGUAGE PolyKinds #-} > {-# LANGUAGE KindSignatures #-} > {-# LANGUAGE TypeOperators #-} > {-# LANGUAGE DataKinds #-} > {-# LANGUAGE OverloadedStrings #-} > {-# LANGUAGE DeriveGeneric #-} > > module Main where > > import qualified Data.ByteString as B > import Data.ByteString(ByteString) > import Data.Serialize -- require cereal > > import GHC.TypeLits > > data Scalar :: Nat -> * -> * where > Nil :: Scalar 0 a > Cons :: a -> Scalar m a -> Scalar (1+m) a > > instance (Serialize a) => Serialize (Scalar 0 a) where > get = return Nil > put _ = return $ mempty > > instance (Serialize a) => Serialize (Scalar n a) where > get = do > x <- get :: Get a > xs <- get :: Get (Scalar (n-1) a) > return $! Cons x xs > put (Cons x xs) = do > put (x :: a) > put xs > > -- > > /tmp/vect1/app/Main.hs:31:15: Couldn't match type ?n? with ?1 + (n - 1)? ? > ?n? is a rigid type variable bound by > the instance declaration at /tmp/vect1/app/Main.hs:27:10 > Expected type: Scalar n a > Actual type: Scalar (1 + (n - 1)) a > Relevant bindings include > xs :: Scalar (n - 1) a (bound at /tmp/vect1/app/Main.hs:30:5) > get :: Get (Scalar n a) (bound at /tmp/vect1/app/Main.hs:28:3) > In the second argument of ?($!)?, namely ?Cons x xs? > In a stmt of a 'do' block: return $! Cons x xs > Compilation failed. > > - baojun > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gcrosswhite at gmail.com Sat Apr 30 18:04:16 2016 From: gcrosswhite at gmail.com (Gregory Crosswhite) Date: Sat, 30 Apr 2016 11:04:16 -0700 Subject: [Haskell-cafe] Taking over cmdtheline Message-ID: <5724F3A0.6070302@gmail.com> The package cmdtheline has not been updated since Apr 30, 2013, and it is broken with the current version of GHC; it needs to have its upper bound on transformers bumped. I tried contacting the author three months ago and three weeks ago to ask him to fix the package, but I received no response. I contacted him one more time one week ago to tell him that I intended to take over the package, and still I received no response. Thus, following the instructions on Hackage for taking over a package, I am officially stating my intent to take over this package so that I can fix it. Cheers, Greg