[Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Dominique Devriese
Hi all, I often find myself needing the following definitions: mapPair :: (a - b) - (c - d) - (a,c) - (b,d) mapPair f g (x,y) = (f x, g y) mapFst :: (a - b) - (a,c) - (b,c) mapFst f = mapPair f id mapSnd :: (b - c) - (a,b) - (a,c) mapSnd = mapPair id But they seem missing from the

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Dominique Devriese
2013/5/28 Tikhon Jelvis tik...@jelv.is: These are present in Control.Arrow as (***), first and second respectively. Right, thanks. Strange that neither Hayoo nor Hoogle turned these up.. Dominique ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] monadic DSL for compile-time parser generator, not possible?

2013-03-13 Thread Dominique Devriese
All, 2013/3/13 o...@okmij.org: So, Code is almost applicative. Almost -- because we only have a restricted pure: pureR :: Lift a = a - Code a with a Lift constraint. Alas, this is not sufficient for realistic parsers, because often we have to lift functions, as in the example of

Re: [Haskell-cafe] monadic DSL for compile-time parser generator, not possible?

2013-03-13 Thread Dominique Devriese
2013/3/13 Dominique Devriese dominique.devri...@cs.kuleuven.be: class ProductionRule p = LiftableProductionRule p where epsilonL :: a - Q Exp - p aSource and associated epsilonLS :: (Lift v, LiftableProductionRule p) = v - p v epsilonLS v = epsilonL v $ lift v Note that the point

Re: [Haskell-cafe] Parser left recursion

2013-02-26 Thread Dominique Devriese
2013/2/26 Martin Drautzburg martin.drautzb...@web.de: I wonder if I can enforce the nonNr property somehow, i.e. enforce the rule will not consider the same nonterminal again without having consumed any input. You might be interested in this paper: Danielsson, Nils Anders. Total parser

Re: [Haskell-cafe] Parser left recursion

2013-02-20 Thread Dominique Devriese
All, Many (but not all) of the parsing algorithms that support left recursion cannot be implemented in Haskell using the standard representation of recursion in parser combinators. The problem can be avoided in Scala because it has imperative features like referential identity and/or mutable

Re: [Haskell-cafe] [Agda] How to avoid T3 fonts in pdf generated with lhs2TeX?

2012-11-01 Thread Dominique Devriese
Andreas, 2012/11/1 Andreas Abel andreas.a...@ifi.lmu.de: Hello, maybe someone has experience in publishing papers that use lhs2TeX and unicode characters with ACM, and has been in my situation before... Sheridan, who publishes for ACM, does not like T3 fonts. However, lhs2tex --agda does

Re: [Haskell-cafe] Applicative functors with branch/choice ?

2012-07-25 Thread Dominique Devriese
Евгений, The possible extension may look somehow like this: class Applicative a = Branching a where branch :: a (Either b c) - (a b - a d) - (a c - a d) - a d What about the following alternative that does not require an extension? import Control.Applicative eitherA :: Applicative f =

Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Dominique Devriese
Patrick, -- Class with functional dependency class QUEUE_SPEC_CLASS2 a q | q - a where newC2 :: q a -- ?? sizeC2 :: q a - Int restC2 :: q a - Maybe (q a) insertC2 :: q a - a - q a The above is a reasonable type class definition for what you seem to intend. -- Without

Re: [Haskell-cafe] TLS 0.9.6, question about session resumption.

2012-07-21 Thread Dominique Devriese
Hi, 2012/7/21 C Gosch ch.go...@googlemail.com: I am trying to use the TLS package from hackage, and it works fine so far -- except when a client wants to do session resumption (note I am not an expert in TLS, so it might be something quite simple). In that case, I get an alert, unexpected

Re: [Haskell-cafe] Martin Odersky on What's wrong with Monads

2012-06-28 Thread Dominique Devriese
2012/6/27 Tillmann Rendel ren...@informatik.uni-marburg.de: MightyByte wrote: Of course every line of your program that uses a Foo will change if you switch to IO Foo instead. But we often have to also change lines that don't use Foo at all. For example, here is the type of binary trees

Re: [Haskell-cafe] lhs2TeX: automatic line wrap within code blocks?

2012-04-05 Thread Dominique Devriese
David, The easiest solution is probably to use multi-line string literals and line-wrap manually: \begin{code} cyphertext = rlkmlj, zlnift ekblvke pqc elvm if pzlp gblrk, akrlomk zk zle \ lfpiriglpke pzlp, if pzk flpojlb rcojmk cs knkfpm, morz qcobe ak pzk rcfeorp \ cs nkjriftkpcjiu, bklnkm

Re: [Haskell-cafe] decoupling type classes

2012-01-17 Thread Dominique Devriese
2012/1/16 Yin Wang yinwa...@gmail.com: The typical example would be instance Eq a = Eq [a] where  [] == [] = True  (a : as) == (b : bs) = a == b as == bs  _ == _ = False It can handle this case, although it doesn't handle it as a parametric instance. I suspect that we don't need the

Re: [Haskell-cafe] decoupling type classes

2012-01-16 Thread Dominique Devriese
Yin, 2012/1/14 Yin Wang yinwa...@gmail.com: On Sat, Jan 14, 2012 at 2:38 PM, Dominique Devriese dominique.devri...@cs.kuleuven.be wrote: I may or may not have thought about it. Maybe you can give an example of parametric instances where there could be problems, so that I can figure out

Re: [Haskell-cafe] decoupling type classes

2012-01-12 Thread Dominique Devriese
Yin, 2012/1/12 Yin Wang yinwa...@gmail.com: I have an idea about type classes that I have been experimenting. It appears to be a generalization to Haskell’s type classes and seems to be doable. It seems to related the three ideas: type classes, implicit parameters, and (typed) dynamic

Re: [Haskell-cafe] Is it possible to represent such polymorphism?

2011-10-04 Thread Dominique Devriese
All, In case anyone is interested, I just want to point out an interesting article about the relation between Haskell type classes and C++ (overloading + concepts): http://sms.cs.chalmers.se/publications/papers/2008-WGP.pdf Dominique 2011/10/3 Ketil Malde ke...@malde.org: sdiy...@sjtu.edu.cn

Re: [Haskell-cafe] Smarter do notation

2011-09-04 Thread Dominique Devriese
It's not the same as what you propose, but it's related, so for discussion, I just want to point out idiom brackets (an analog for do-notation for Applicative functors) which have been introduced in some Haskell-related languages. Examples are Idris

Re: [Haskell-cafe] SIGPLAN Programming Languages Software Award

2011-06-09 Thread Dominique Devriese
2011/6/9 Stephen Tetley stephen.tet...@gmail.com: On 9 June 2011 09:02, Yves Parès limestr...@gmail.com wrote: Were templates an original feature of C++ or did they appear in a revision of the langage ? Because C++ appeared in 1982 and Haskell in 1990. Templates were a later addition to C++.

Re: [Haskell-cafe] Random thoughts about typeclasses

2011-05-18 Thread Dominique Devriese
Robert, 2011/5/16 Robert Clausecker fuz...@gmail.com: I found out, that GHC implements typeclasses as an extra argument, a record that stores all functions of the typeclass. So I was wondering, is there a way (apart from using newtype) to pass a custom record as the typeclass record, to

Re: [Haskell-cafe] Robert Harper on monads and laziness

2011-05-03 Thread Dominique Devriese
2011/5/3 Manuel M T Chakravarty c...@cse.unsw.edu.au: Interestingly, today (at least the academic fraction of) the Haskell community appears to hold the purity of the language in higher regard than its laziness. I find Greg Morissett's comment on Lennart Augustsson's article pro lazy

Re: [Haskell-cafe] Robert Harper on monads and laziness

2011-05-02 Thread Dominique Devriese
2011/5/2 Ketil Malde ke...@malde.org: There is a particular reason why monads had to arise in Haskell, though, which is to defeat the scourge of laziness. My own view is/was that monads were so successful in Haskell since it allowed writing flexible programs with imperative features,

Re: [Haskell-cafe] Proving correctness

2011-02-11 Thread Dominique Devriese
Kashyap, 2011/2/11 C K Kashyap ckkash...@gmail.com: I've come across this a few times - In Haskell, once can prove the correctness of the code - Is this true? I know that static typing and strong typing of Haskell eliminate a whole class of problems - is that related to the proving

Re: [Haskell-cafe] [Haskell] Problems with (projects|community).haskell.org

2011-02-10 Thread Dominique Devriese
Also, is there any news yet on a procedure for community members with accounts on projects.haskell.org to get access to them again? My ssh publickey login is no longer being accepted. I had an account mainly for hosting the darcs repo and the website for my project grammar-combinators. The website

Re: [Haskell-cafe] Haskell for children? Any experience?

2011-01-27 Thread Dominique Devriese
Hi, I'm also curious about this. Is a pure programming style like Haskell's less or more natural than an imperative mutable-state based one to kids without experience. I intuitively expect that for kids with a high-school background in mathematics would find the first more natural, but this is

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2011-01-04 Thread Dominique Devriese
All, 2010/12/27 Jonathan Geddes geddes.jonat...@gmail.com: I see TH used most for the following tasks: #1 Parse a string at compile-time so that a custom syntax for representing data can be used. At the extreme, this data might even be an EDSL. #2 Provide instances automatically. Just a

[Haskell-cafe] Decoupling type classes (e.g. Applicative)?

2010-10-29 Thread Dominique Devriese
Hi all, I have a problem with the design of the Applicative type class, and I'm interested to know people's opinion about this. Currently, the Functor and Applicative type class are defined like this: class Functor f where fmap:: (a - b) - f a - f b class Functor f =

[Haskell-cafe] Re: [Haskell] Specification and prover for Haskell

2010-10-25 Thread Dominique Devriese
Romain, 2010/10/25 Romain Demeyer r...@info.fundp.ac.be: I'm working on static verification in Haskell, and I search for existing works on specification of Haskell programs (such as pre/post conditions, for example) or any other functional language. It would be great if there exists a prover

Re: [Haskell-cafe] pointers for EDSL design

2010-10-12 Thread Dominique Devriese
2010/10/12 o...@okmij.org: An alternative approach to model sharing at the object level is the technique I use for modelling context-free grammars in my PADL 2011 paper Explicitly Recursive Grammar Combinators...  Using ideas from the Multirec generic programming library and some recent

Re: [Haskell-cafe] pointers for EDSL design

2010-10-11 Thread Dominique Devriese
John, Oleg, 2010/10/9 o...@okmij.org: So here's a very simple expression: t1 = let v = sigGen (cnst 1) in outs v v which is what led to my question.  I'm binding the sigGen to 'v' to introduce sharing at the meta-level.  Would it be better to introduce support for this in the dsl? Often

Re: [Haskell-cafe] [Off-topic]Functional parsing theory

2010-10-06 Thread Dominique Devriese
Mauricio, 2010/10/6 Maurí­cio CA mauricio.antu...@gmail.com: I've been working in a tool that reads a grammar with associated actions and act on input based on that grammar. I would like to rewrite it in a functional style, but I've not been able to find a theory that would handle any

Re: [Haskell-cafe] Re: Suggestions for improvement

2010-10-05 Thread Dominique Devriese
2010/10/5 N. Raghavendra ra...@mri.ernet.in: At 2010-10-03T22:45:30+02:00, Dominique Devriese wrote: comma :: (a - b) - (a - c) - a - (b,c) comma f g x = (f x, g x) comma = liftA2 (,) blowup = (uncurry (++)) . liftA2 (,) (blowup . allButLast) lastToTheLength I tried both of them

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread Dominique Devriese
One question I have is whether I can eliminate points in the above definition of blowup, and write something like blowup = (++) . (blowup . allButLast, lastToTheLength) thinking of (++) as a function String x String - String. Actually (++) is of type String - String - String. When you

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread Dominique Devriese
Gregory, 2010/10/3 Gregory Crosswhite gcr...@phys.washington.edu:  On 10/3/10 1:45 PM, Dominique Devriese wrote: Additionally, you can't combine the functions (blowup . allButLast) and lastToTheLength into a function that returns a pair like you seem to attempt. You need a function like

Re: [Haskell-cafe] Fwd: Type families - how to resolve ambiguities?

2010-09-12 Thread Dominique Devriese
Paolo, The problem with mult is that k is not specified unambiguously. You either need v to determine k (which is probably not what you want, at a guess), mult to take a dummy argument that determines what k is: [...] or, to make Tensor a data family instead of a type family. What is the

[Haskell-cafe] ANNOUNCE: grammar-combinators 0.1 (initial release): A parsing library of context-free grammar combinators

2010-09-08 Thread Dominique Devriese
The grammar-combinators library is a parsing library employing a novel grammar representation with explicit recursion. The library features much of the power of a parser generator like Happy or ANTLR, but with the library approach and most of the benefits of a parser combinator library. Grammars

[Haskell-cafe] Re: ANNOUNCE: grammar-combinators 0.1 (initial release): A parsing library of context-free grammar combinators

2010-09-08 Thread Dominique Devriese
Some snippets from the Tutorial [1] to give an idea of the grammar-combinator library's approach, its functional style and its additional power (e.g. the transformations used): Defining a simple expresssions grammar: grammarArith :: ExtendedContextFreeGrammar ArithDomain Char grammarArith

Re: [Haskell-cafe] Re: ANNOUNCE: grammar-combinators 0.1 (initial release): A parsing library of context-free grammar combinators

2010-09-08 Thread Dominique Devriese
Johannes, (sorry for the double mail) I will give some short answers below, but you can find more details in the paper we are submitting to PADL 2011 [1]. 2010/9/8 Johannes Waldmann waldm...@imn.htwk-leipzig.de: .. grammar-combinator library's approach .. am I reading this correctly: in the

Re: [Haskell-cafe] Re: ANNOUNCE: grammar-combinators 0.1 (initial release): A parsing library of context-free grammar combinators

2010-09-08 Thread Dominique Devriese
Johannes, 2010/9/8 Johannes Waldmann waldm...@imn.htwk-leipzig.de: That compilation process is highly nonlocal and would never be possible with, e.g., the Parsec approach. Pipe dream: attach such a grammar object to every Parsec parser, and include the compiler with the combinators, and

Re: [Haskell-cafe] Which Mail editor or mail chain do you use ?

2010-08-17 Thread Dominique Devriese
2010/8/17 Luc TAESCH luc.tae...@googlemail.com: May I ask you how you redact your answers and which toolchain you are using? You can use footnote-mode [1] for easily producing the footnotes/references if you're an emacs user. Dominique Footnotes: [1]

Re: [Haskell-cafe] datatype contexts

2010-07-26 Thread Dominique Devriese
2010/7/26 Ryan Ingram ryani.s...@gmail.com: There are two types of datatype contexts; haskell'98 contexts (which I think are terrible), and GHC existential contexts (which I like): See also GADT-style data type declarations [1] and full GADT's [2], which both behave like GHC existential

Re: [Haskell-cafe] DpH/repa cache locality

2010-07-13 Thread Dominique Devriese
Hi, 2010/7/13 Gregory Crosswhite gcr...@phys.washington.edu: Just out of curiosity, what work is being done in the data parallel haskell / repa projects regarding cache locality? Hi, I'm not knowledgeable at all about this, but for a technical introduction to DPH, I found the following