[Haskell-cafe] ANNOUNCE: sloth-0.0.1

2012-01-10 Thread Jan Christiansen
Hi, I have just released a prototype implementation of a tool (http://hackage.haskell.org/package/sloth) for checking whether a function is unnecessarily strict. It is inspired by Olaf Chitils StrictCheck tool (http://www.cs.kent.ac.uk/people/staff/oc/) but does not propose improvements that l

Re: [Haskell-cafe] space-efficient, composable list transformers [was: Re: Reifying case expressions]

2012-01-02 Thread Jan Christiansen
Hi, On Jan 2, 2012, at 2:34 PM, Heinrich Apfelmus wrote: > Without an explicit guarantee that the function is incremental, we can't do > anything here. But we can just add another constructor to that effect if we > turn ListTo into a GADT: > >data ListTo a b where >CaseOf :: b

Re: [Haskell-cafe] Properties for Foldable

2011-07-29 Thread Jan Christiansen
On Jul 30, 2011, at 12:40 AM, Sebastian Fischer wrote: > Interesting. However I don't understand why the instance in Section > 5.5 is not already forbidden by the "purity law" > >traverse pure = pure > > and a "'no duplication' constraint" would be necessary. For example: > >traverse I

Re: [Haskell-cafe] Properties for Foldable

2011-07-29 Thread Jan Christiansen
Hi, On Jul 29, 2011, at 10:15 PM, Conal Elliott wrote: > Is there a collection of laws associated with the Foldable class? Or for > Traversable? - Conal if you are not aware of "The essence of the Iterator pattern" by Jeremy Gibbons and Bruno Oliveira (http://citeseerx.ist.psu.edu/viewdoc/do

Re: [Haskell-cafe] How large is the Haskell community ?

2011-02-12 Thread Jan Christiansen
On 12.02.2011, at 21:18, Aaron Gray wrote: I was wondering if anyone had an idea or estimate as to how large the Haskell community is ? All the answers made me wonder what the criterion is to be a member of the Haskell community. Are you a member if you downloaded ghc, if you have (at le

Re: [Haskell-cafe] Are constructors strict?

2011-01-26 Thread Jan Christiansen
Hi, On 22.01.2011, at 08:12, Sebastian Fischer wrote: Also, Jan, I don't understand your comment about continuation monads. Maybe I am a bit numb today.. What property do you mean do continuation monads have or not? I was wrong there. If there exist values x and y with x /= y and you hav

Re: [Haskell-cafe] Are constructors strict?

2011-01-21 Thread Jan Christiansen
On 21.01.2011, at 11:52, Daryoush Mehrtash wrote: Do I have to have MonadPlus m or would any other Monad class work the same way? Not all monad instances satisfy undefined >>= return . Just = undefined if that's what you are asking for. For example, consider the identity monad. in

Re: [Haskell-cafe] Are constructors strict?

2011-01-21 Thread Jan Christiansen
On 20.01.2011, at 22:18, Daryoush Mehrtash wrote: I am having hard time understanding the following paragraph in "Purely functional Lazy non-deterministic programing" paper http://www.cs.rutgers.edu/~ccshan/rational/lazy-nondet.pdf The problem with the naive monadic encoding of non-determi

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Jan Christiansen
On 02.10.2010, at 20:35, Henning Thielemann wrote: On Sat, 2 Oct 2010, Colin Paul Adams wrote: Prelude> (if then "Haskell" else "Cafe") False Max> "Cafe" My reaction is to ask: Can you write this as: (if then else) False "Haskell" "Cafe" ? Sure: ifThenElse :: Bool -> a -> a ->

Re: [Haskell-cafe] Re: Coding conventions for Haskell?

2010-10-01 Thread Jan Christiansen
Hi, On 01.10.2010, at 09:57, Wolfgang Jeltsch wrote: I think this is much more readable, since you can easily see which of those lines belong together. I wonder whether there are empirical results which show that a certain kind of spacing is more readable for a certain kind of programmer (f

Re: [Haskell-cafe] gathering position information lazily using traverse

2010-09-10 Thread Jan Christiansen
On 10.09.2010, at 23:58, Felipe Lessa wrote: H... On Fri, Sep 10, 2010 at 6:47 PM, Jan Christiansen wrote: instance Applicative Proj where pure = Proj . const Proj f <*> Proj x = Proj (\p -> f (False:p) (x (True:p))) (pure f) <*> Proj x === Proj (cons

[Haskell-cafe] gathering position information lazily using traverse

2010-09-10 Thread Jan Christiansen
Dear Applicative experts, I am seeking advice on Applicative instances and their use in traverse. Consider the following Applicative instance. newtype Proj a = Proj { unProj :: [Bool] -> a } instance Functor Proj where fmap g (Proj f) = Proj (g . f) instance Applicative Proj where

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-03 Thread Jan Christiansen
On 03.09.2010, at 14:38, Daniel Fischer wrote: I can't reproduce that. For me, it leaks also with profiling. Have you used optimizations? It disappears if I compile the program with -O2. Without profiling I get the following. Here the maximum residency is nearly 45MB. $ ghc --make Tem

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Jan Christiansen
Hi, On 02.09.2010, at 13:41, Daniel Fischer wrote: takes a little to run and keeps the entire file until the first occurrence of pat in memory. first of all thanks very much for the detailed instructions. I have rewritten the example slightly using Strings instead of Bytestrings. Replaci

Re: [Haskell-cafe] Unnecessarily strict implementations

2010-09-02 Thread Jan Christiansen
Hi, On 02.09.2010, at 01:35, Daniel Fischer wrote: It's not that it's not as non-strict as possible per se. (Sorry, had to :) It's that intersperse's current definition (in GHC at least) can cause a space leak. In this case, making the function less strict can cure it, in other cases, mor

[Haskell-cafe] Unnecessarily strict implementations

2010-09-01 Thread Jan Christiansen
Hi, there is a new ticket that Data.List.intersperse is not as non-strict as possible (http://hackage.haskell.org/trac/ghc/ticket/4282). I have observed some other functions which are unnecessarily strict and it might be advantageous to change their definitions as well. I think it is know

Re: [Haskell-cafe] powerSet = filterM (const [True, False]) and Data.List permutation

2009-08-05 Thread Jan Christiansen
Hi, i am replying to a thread called "Data.List permutations" on ghc- users and a thread called "powerSet = filterM (const [True, False]) ... is this obfuscated haskell?" on haskell cafe. On 04.08.2009, at 19:48, Slavomir Kaslev wrote: A friend mine, new to functional programming, was ent

Re: [Haskell-cafe] Suggestions for simulating Object ID

2009-06-30 Thread Jan Christiansen
Hi, On 30.06.2009, at 11:55, Hemanth Kapila wrote: Can some one please suggest something on simulating some sort of "object-Ids" in Haskell? I mean, something like the following relation will hold: > a1 == a2 = (objectID a1) == (objectID a2) I am not quite sure but perhaps Stable Names a

[Haskell-cafe] memoization using unsafePerformIO

2009-06-23 Thread Jan Christiansen
Hi, I have tried to implement a memo function using stable names and weak pointers like it is presented in the paper "stretching the storage manager". There is an abstract datatype SNMap a b which implements a map that maps values of type StableName a to values of type b. The map is locat

Re: [Haskell-cafe] Maintaining laziness: another example

2009-06-08 Thread Jan Christiansen
Hi, this is a very nice example. On 08.06.2009, at 14:31, Eugene Kirpichov wrote: Cool! Probably one should start teaching with 'case' instead of pattern function definitions; that would put an accent on what is forced and in what order. I like this idea. Only after the student understands

Re: [Haskell-cafe] Purely logical programming language

2009-05-26 Thread Jan Christiansen
Hi, On 26.05.2009, at 21:24, Lauri Alanko wrote: Mercury also has type classes and other Haskellisms, so if you're interested in "doing Prolog the Haskell way", you should definitely have a look at it. I have to admit that I am not very familiar with Mercury. But if you are looking for "doi

Re: [Haskell-cafe] monad . comonad = id

2009-05-08 Thread Jan Christiansen
Hi, On 08.05.2009, at 13:14, Miguel Mitrofanov wrote: I have a question regarding the connection between monads and comonads. I always thought of the comonad operations as being the inverse operations of the corresponding monad functions. That's not true. I thought there is some kind of

[Haskell-cafe] monad . comonad = id

2009-05-08 Thread Jan Christiansen
Hi, I have a question regarding the connection between monads and comonads. I always thought of the comonad operations as being the inverse operations of the corresponding monad functions. As I do not know the underlying theory I thought I simply ask the masters. Is there a formal verific

Re: [Haskell-cafe] Code Golf

2009-04-16 Thread Jan Christiansen
Hi, On 16.04.2009, at 05:08, Matt Morrow wrote: And i forgot to include the defs of (co)prod: prod (><) p1 p2 = (\a -> p1 a >< p2 a) I think this one is liftM2 of the ((->) a) Monad instance. Cheers, Jan ___ Haskell-Cafe mailing list Haskell-C

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Jan Christiansen
Hi, On 15.04.2009, at 13:28, Sebastian Fischer wrote: Actually, there are a number of implementations that implement the same behaviour as the original version, e.g., diag = concat . foldr diags [] where diags [] ys = ys diags (x:xs) ys = [x] :

Re: Re: [Haskell-cafe] How to make code least strict?

2009-01-22 Thread Jan Christiansen
Thomas Davie wrote: > > Further to all the playing with unamb to get some very cool behaviors, > you might want to look at Olaf Chitil's paper here: > > http://www.cs.kent.ac.uk/pubs/2006/2477/index.html > > It outlines a tool for checking if your programs are as non-strict as > they can

Re: [Haskell-cafe] Maintaining laziness

2009-01-16 Thread Jan Christiansen
Am 14.01.2009 um 15:26 schrieb Henning Thielemann: See the List functions in http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ utility-ht Version 0.0.1 was before applying StrictCheck, 0.0.2 after processing its suggestions. I have stopped when I saw that it repeatedly shows

Re: [Haskell-cafe] Maintaining laziness

2009-01-13 Thread Jan Christiansen
Hi, Am 12.01.2009 um 14:37 schrieb Henning Thielemann: On Mon, 12 Jan 2009, Jan Christiansen wrote: I am not sure whether this would be a good idea. The original version makes a lot of suggestions which are not satisfiable but it is not at all trivial to decide which are satisfiable and

Re: [Haskell-cafe] Maintaining laziness

2009-01-12 Thread Jan Christiansen
Hi, Although it seems to be overkill for a single module - How about a cabalized version on Hackage and a darcs repository? It would simplify using and updating it. I am not sure whether this would be a good idea. The original version makes a lot of suggestions which are not satisfiable b

[Haskell-cafe] Maintaining laziness

2009-01-07 Thread Jan Christiansen
This is great. I am working on the very same topic for quite a while now. My aim is to develop a tool that tells you whether a function is least strict. My work is based on an idea by Olaf Chitil: http://www.cs.kent.ac.uk/people/staff/oc/ I think he was the first who introduced the idea of l

Re: [Haskell-cafe] Re: Composition of Type Constructors

2005-05-30 Thread Jan Christiansen
On Wednesday 25 May 2005 17:20, Chung-chieh Shan wrote: Jan Christiansen <[EMAIL PROTECTED]> wrote in article <[EMAIL PROTECTED]> in gmane.comp.lang.haskell.cafe: The problem is that I don't know how to express the composition of type constructors like the function (.) for o

[Haskell-cafe] Composition of Type Constructors

2005-05-25 Thread Jan Christiansen
Hi! I would like to define a type class for a data structure that supports a lookup and an update function like the following one. class Mapping map key where lookup :: key -> map v -> v update :: key -> (v -> v) -> map v -> map v Now I want to lift this to a class instance for tuples of k