Re: [Haskell-cafe] foldr (.) id

2012-10-29 Thread Sebastian Fischer
(.)/compose is consistent with (+)/sum, (*)/product, ()/and, etc. (to) compose is a verb. composition would be consistent with sum and product. and doesn't fit, though. Sebastian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] [Snap] Argument Substitution in Heist Templates with Splices

2012-09-23 Thread Sebastian Fischer
tag. This avoids the infinite recursion and will work the way you want without needing stopRecursion. On Thu, Sep 20, 2012 at 3:00 PM, Sebastian Fischer m...@sebfisch.de wrote: Hello, the following program demonstrates that arguments in Heist templates are sometimes not substituted

[Haskell-cafe] [Snap] Argument Substitution in Heist Templates with Splices

2012-09-20 Thread Sebastian Fischer
Hello, the following program demonstrates that arguments in Heist templates are sometimes not substituted in presence of splices: {-# LANGUAGE OverloadedStrings #-} import Blaze.ByteString.Builder (toByteString) import qualified Data.ByteString.Char8as BS import

Re: [Haskell-cafe] Monad laws in presence of bottoms

2012-02-20 Thread Sebastian Fischer
On Mon, Feb 20, 2012 at 7:42 PM, Roman Cheplyaka r...@ro-che.info wrote: Is there any other interpretation in which the Reader monad obeys the laws? If selective strictness (the seq combinator) would exclude function types, the difference between undefined and \_ - undefined could not

Re: [Haskell-cafe] Monads, do and strictness

2012-01-23 Thread Sebastian Fischer
On Sun, Jan 22, 2012 at 5:25 PM, David Barbour dmbarb...@gmail.com wrote: The laws for monads only apply to actual values and combinators of the monad algebra You seem to argue that, even in a lazy language like Haskell, equational laws should be considered only for values, as if they where

Re: [Haskell-cafe] Monads, do and strictness

2012-01-22 Thread Sebastian Fischer
On Sat, Jan 21, 2012 at 8:09 PM, David Barbour dmbarb...@gmail.com wrote: In any case, I think the monad identity concept messed up. The property:   return x = f = f x Logically only has meaning when `=` applies to values in the domain. `undefined` is not a value in the domain. We can

Re: [Haskell-cafe] Avoiding parametric function binding

2012-01-01 Thread Sebastian Fischer
On Sat, Dec 31, 2011 at 4:09 PM, Kevin Quick qu...@sparq.org wrote: onVarElem :: forall a . (Show a) = (Maybe a - String) - Var - String onVarElem f (V1 x) = f x onVarElem f (V2 x) = f x main = putStrLn . onVarElem elemStr $ test This is probably a better design, but still fails for the

[Haskell-cafe] space-efficient, composable list transformers [was: Re: Reifying case expressions [was: Re: On stream processing, and a new release of timeplot coming]]

2011-12-28 Thread Sebastian Fischer
Hello Heinrich, On Tue, Dec 27, 2011 at 1:09 PM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Sebastian Fischer wrote: all functions defined in terms of `ListTo` and `interpret` are spine strict - they return a result only after consuming all input list constructors. Indeed

Re: [Haskell-cafe] Reifying case expressions [was: Re: On stream processing, and a new release of timeplot coming]

2011-12-27 Thread Sebastian Fischer
On Tue, Dec 27, 2011 at 5:35 AM, Eugene Kirpichov ekirpic...@gmail.comwrote: I wonder if now this datatype of yours is isomorphic to StreamSummary b r - StreamSummary a r. Not sure what you mean here. StreamSummary seems to be the same as ListConsumer but I don't see how functions from

Re: [Haskell-cafe] Reifying case expressions [was: Re: On stream processing, and a new release of timeplot coming]

2011-12-26 Thread Sebastian Fischer
On Sun, Dec 25, 2011 at 11:25 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Your StreamSummary type has a really nice interpretation: it's a reification of case expressions [on lists]. nice observation! For instance, consider the following simple function from lists to

Re: [Haskell-cafe] Reifying case expressions [was: Re: On stream processing, and a new release of timeplot coming]

2011-12-26 Thread Sebastian Fischer
2011/12/26 Eugene Kirpichov ekirpic...@gmail.com Whoa. Sebastian, you're my hero — I've been struggling with defining Arrow for ListTransformer for a substantial time without success, and here you got it, dramatically simpler than I thought it could be done (I was using explicit queues).

Re: [Haskell-cafe] [Alternative] summary of my understanding so far

2011-12-18 Thread Sebastian Fischer
On Thu, Dec 15, 2011 at 9:13 AM, Gregory Crosswhite gcrosswh...@gmail.comwrote: To quote Ross Paterson's proposals: instance Alternative [] where ... some [] = [] some (x:xs) = repeat (repeat x) many [] = [[]] many (x:xs) = repeat (repeat x) Isn't this instance

Re: [Haskell-cafe] extending and reusing cmdargs option specs ?

2011-09-13 Thread Sebastian Fischer
Hi Simon, On Tue, Sep 13, 2011 at 12:13 AM, Simon Michael si...@joyful.com wrote: Is that because of = auto ? I'm not sure. The feature was added in version 0.2 and is described in issue 333: http://code.google.com/p/ndmitchell/issues/detail?id=333 The description does not mention = auto.

Re: [Haskell-cafe] extending and reusing cmdargs option specs ?

2011-09-12 Thread Sebastian Fischer
Hi Simon, while it is not possible to reuse the definitions of common fields themselves, their *descriptions* need to be given only once. Not sure if you are already sharing descriptions or if it helps you saving a few more lines. See

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Sebastian Fischer
Hi Max, thanks for you proposal! Using the Applicative methods to optimise do desugaring is still possible, it's just not that easy to have that weaken the generated constraint from Monad to Applicative since only degenerate programs like this one won't use a Monad method: Is this still

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Sebastian Fischer
, 2011 at 5:37 PM, Sebastian Fischer fisc...@nii.ac.jp wrote: Hi Max, thanks for you proposal! Using the Applicative methods to optimise do desugaring is still possible, it's just not that easy to have that weaken the generated constraint from Monad to Applicative since only degenerate programs

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Sebastian Fischer
On Mon, Sep 5, 2011 at 10:19 PM, Thomas Schilling nomin...@googlemail.comwrote: a = \p - f $ b -- 'free p' and 'free b' disjoint -- ((\p - f) $ a) * b Will there also be an optimisation for some sort of simple patterns? I.e., where we could rewrite this to: liftA2 (\pa pb - f ...) a

Re: [Haskell-cafe] Smarter do notation

2011-09-04 Thread Sebastian Fischer
On Sun, Sep 4, 2011 at 11:34 AM, Daniel Peebles pumpkin...@gmail.com wrote: I was wondering what people thought of a smarter do notation. I'd support it (for both do notation and monad comprehensions) once Applicative is a superclass of Monad. To me it looks light a slight complication for an

Re: [Haskell-cafe] Smarter do notation

2011-09-04 Thread Sebastian Fischer
These are important questions. I think there is a trade-off between supporting many cases and having a simple desugaring. We should find a sweet-spot where the desugaring is reasonably simple and covers most idiomatic cases. So I guess it's possible to detect the pattern: do x1 - foo1; ...;

Re: [Haskell-cafe] Pointed, but not Applicative

2011-08-30 Thread Sebastian Fischer
On Wed, Aug 31, 2011 at 6:13 AM, Ryan Ingram ryani.s...@gmail.com wrote: technically it violates 'fmap id' == 'id' [...] If you add this FList law, though, you're OK: runFList fl as = runFList fl [] ++ as I think the idea of functional lists is that the monoids of 'lists' and 'functions on

Re: [Haskell-cafe] Pointed, but not Applicative

2011-08-30 Thread Sebastian Fischer
   toFList [] = id    toFList (xs++ys) = toFList xs . toFList ys    toList id = []    toList (f . g) = toList f ++ toList g These laws do not *define* the isomorphisms because their behavior on singletons is not fixed. Combining them with laws using a 'point' function for functional lists

Re: [Haskell-cafe] Pointed, but not Applicative

2011-08-28 Thread Sebastian Fischer
On Sun, Aug 28, 2011 at 12:41 AM, Sönke Hahn sh...@cs.tu-berlin.de wrote: I was wondering which type could be an instance of Pointed, but not of Applicative. But I can't think of one. Any ideas? Functional lists: type FList a = [a] - [a] they have a Monoid instance for empty and append,

Re: [Haskell-cafe] Pointed, but not Applicative

2011-08-28 Thread Sebastian Fischer
On Mon, Aug 29, 2011 at 12:24 PM, Maciej Marcin Piechotka uzytkown...@gmail.com wrote: instance Functor FList where    f `fmap` FList g = ...? Yes, Functor is also one of the classes that can only be implemented by converting to ordinary lists (I think). So FList could only be made an

Re: [Haskell-cafe] a minor bug (memory leak) in ListLike package

2011-08-26 Thread Sebastian Fischer
On Wed, Aug 24, 2011 at 3:47 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: I was just trying to remember some of the tricks Daniel Peebles (aka {co}pumpkin) used to do in #haskell with Data.List.genericLength. I've never really used ListLike, but was just trying to guess why the

Re: [Haskell-cafe] a minor bug (memory leak) in ListLike package

2011-08-23 Thread Sebastian Fischer
On Wed, Aug 24, 2011 at 10:47 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 24 August 2011 11:10, bob zhang bobzhang1...@gmail.com wrote: Hi, John, there is a space leak problem in ListLike typeclass, in the method genericLength calclen !accum cl = calclen accum cl = I

Re: [Haskell-cafe] ANNOUNCE: TKYProf

2011-08-16 Thread Sebastian Fischer
I'm glad to announce the alpha release of TKYProf. This looks useful, thanks! I'll try it out and let you know if I have problems. Installing with GHC 7.2, I needed to relax some upper bounds in cabal files of dependencies (maintainers CC'ed). - email-validate and ranges specify base 4.4

Re: [Haskell-cafe] strictness properties of monoidal folds

2011-08-14 Thread Sebastian Fischer
Hello Alexey, sorry for my slow response. On Thu, Aug 4, 2011 at 7:10 AM, Alexey Khudyakov alexey.sklad...@gmail.comwrote: On 02.08.2011 08:16, Sebastian Fischer wrote: Data.Foldable also provides the monoidal fold function foldMap. It is left unspecified whether the elements

Re: [Haskell-cafe] Building ? using kleene closure {not haskell specific}

2011-08-12 Thread Sebastian Fischer
I can easily understand how + can be built but am having trouble with building ? (zero or one). If there is a regular expression e for the empty word, one can define ? as a? = e | a If there is a regular expression o that never matches one can define e as e = o* If there are

Re: [Haskell-cafe] ANNOUNCE: yap-0.0 - yet another prelude

2011-08-11 Thread Sebastian Fischer
[switched to Cafe] On Wed, Aug 10, 2011 at 11:46 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Wed, 10 Aug 2011, Paterson, Ross wrote: Yet another restructuring of the Prelude numeric classes on algebraic lines, proposed for a revision of the Haskell Prelude:

Re: [Haskell-cafe] weird type signature in Arrow Notation

2011-08-04 Thread Sebastian Fischer
here is a reduced program that still segfaults: {-# LANGUAGE Arrows #-} import Control.Arrow main :: IO () main = print segfault segfault :: [()] segfault = anythingYouWant () anythingYouWant :: a anythingYouWant = testB False (const ()) () testB :: ArrowChoice arrow = bool - arrow ()

Re: [Haskell-cafe] weird type signature in Arrow Notation

2011-08-04 Thread Sebastian Fischer
I created a ticket with a slightly further simplified program: http://hackage.haskell.org/trac/ghc/ticket/5380 On Fri, Aug 5, 2011 at 10:10 AM, Sebastian Fischer fisc...@nii.ac.jpwrote: here is a reduced program that still segfaults: {-# LANGUAGE Arrows #-} import Control.Arrow main :: IO

[Haskell-cafe] strictness properties of monoidal folds

2011-08-01 Thread Sebastian Fischer
Hello Cafe, left- and rightwards folds come in strict and lazy variants foldl/fold' and foldr/foldr' which makes sense because strict versions sometimes use less stack space while lazy versions support infinite data. For example, head (foldr (:) [] [1..]) returns in an instant while

Re: [Haskell-cafe] Properties for Foldable

2011-07-29 Thread Sebastian Fischer
 http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf 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 Id

Re: [Haskell-cafe] Properties for Foldable

2011-07-29 Thread Sebastian Fischer
What am I missing? I suspect you missed the use of const Doh! I completely overlooked that it's about duplication of *effects*. Thanks, Sebastian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] For class Monoid; better names than mempty mappend might have been: mid (mident) mbinop

2011-07-24 Thread Sebastian Fischer
because list is a (the?) free monoid. Yes, all free monoids are isomorphic (to lists). Sebastian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Subcategories on Hackage

2011-06-04 Thread Sebastian Fischer
http://www.shirky.com/writings/ontology_overrated.html On Sat, Jun 4, 2011 at 10:02 AM, Tillmann Vogt tillmann.v...@rwth-aachen.de wrote: Hi, There are some categories on Hackage that have become so large that it is hard to find something, i.e. Data(414 packages) and Graphics (191). Thats

[Haskell-cafe] Student Internships for Parallel Haskell Programming at NII, Tokyo

2011-05-30 Thread Sebastian Fischer
As part of my research fellowship at the National Institute of Informatics in Tokyo, I announce the availability of student internships for up to three months between July and September 2011. Qualified applicants are enrolled in a Masters or Phd program, have a firm grasp of the Haskell

Re: [Haskell-cafe] For Euler 25; What is the first term in the Fibonacci sequence to contain 1000 digits?; the following seems to work.

2011-05-19 Thread Sebastian Fischer
On Thu, May 19, 2011 at 7:29 PM, KC kc1...@gmail.com wrote: For Euler 25; What is the first term in the Fibonacci sequence to contain 1000 digits?; the following seems to work. -- For number of digits being 5 or more. fibNdigits :: Int - Int fibNdigits nDigits = floor (((fromIntegral

Re: [Haskell-cafe] Programming Chalenges: The 3n+1 problem

2011-04-15 Thread Sebastian Fischer
On Thu, Apr 14, 2011 at 8:02 PM, Luke Palmer lrpal...@gmail.com wrote: For this problem, it is too slow to memoize everything; you have to use a bounded memo table. That's why I use a combinator-based memo approach as opposed to the type-directed approach used in eg. MemoTrie. The memo table

Re: [Haskell-cafe] Programming Chalenges: The 3n+1 problem

2011-04-14 Thread Sebastian Fischer
Hi Dimitri, When asking how to implement cache in Haskell I was hopping that there exists some solution without using Data.Array, more functional approach, if I may say so  ... Steven's second solution is purely functional. It uses so-called tries to cache results instead of mutable arrays.

[Haskell-cafe] efficient parallel foldMap for lists/sequences

2011-04-01 Thread Sebastian Fischer
Hello Haskellers, in parallel programs it is a common pattern to accumulate a list of results in parallel using an associative operator. This can be seen as a simple form of the map-reduce pattern where each element of the list is mapped into a monoid before combining the results using `mconcat`.

Re: [Haskell-cafe] Where to put a library

2011-03-02 Thread Sebastian Fischer
Hi Richard, On Thu, Mar 3, 2011 at 1:46 AM, Richard Senington sc06...@leeds.ac.ukwrote: The file parsers are designed to process files coming out of the TSPLIB and SATLIB repositories. [...] Since these are all related I was going to try to put them together into a single library and post

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-17 Thread Sebastian Fischer
On Thu, Feb 17, 2011 at 4:57 PM, Max Bolingbroke batterseapo...@hotmail.com wrote: I think the problem is that the mtl1 Functor instances looked like: instance Monad m = Functor (ReaderT e m) where fmap = ... But the mtl2/transformers instances look like: instance Functor f = Functor

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Sebastian Fischer
On Thu, Feb 17, 2011 at 11:32 AM, Evan Laforge qdun...@gmail.com wrote: Or will there just be massive signature rewriting in the wake of mtl2? I must admit I still don't understand your exact problem. Could you help me with an example where using mtl2 requires an additional (Functor m)

Re: [Haskell-cafe] Proving correctness

2011-02-11 Thread Sebastian Fischer
I've come across this a few times - In Haskell, once can prove the correctness of the code - Is this true? One way to prove the correctness of a program is to calculate it from its specification. If the specification is also a Haskell program, equational reasoning can be used to transform a

Re: [Haskell-cafe] Concurrency best practices?

2011-02-05 Thread Sebastian Fischer
Hi Wren, maybe Twilight STM is for you: http://hackage.haskell.org/package/twilight-stm Sebastian On Sat, Feb 5, 2011 at 6:46 PM, wren ng thornton w...@freegeek.org wrote: So I'm working on a project that uses STM to run a lot of things in parallel without the headaches of locks. So far it's

Re: [Haskell-cafe] MonadPeelIO instance for monad transformers on top of forall

2011-02-04 Thread Sebastian Fischer
Hi Max, data M a = M { unM :: forall m. MonadPeelIO m = Reader.ReaderT () m a } It seems clear that there should be a MonadPeelIO instance for M, but I can't for the life of me figure it out. Have you (or the big brains on Haskell-Cafe, who are CCed) come across this before? Is there an

Re: [Haskell-cafe] parsing exercise

2011-01-23 Thread Sebastian Fischer
On Sun, Jan 23, 2011 at 4:31 PM, Chung-chieh Shan ccs...@post.harvard.eduwrote: Maybe Text.Show.Pretty.parseValue in the pretty-show package can help? That's what I was looking for, thanks! On Sun, Jan 23, 2011 at 5:23 PM, Stephen Tetley stephen.tet...@gmail.com wrote: I don't think you

Re: [Haskell-cafe] Are constructors strict?

2011-01-22 Thread Sebastian Fischer
Hi Daryoush, On Fri, Jan 21, 2011 at 7:52 PM, Daryoush Mehrtash dmehrt...@gmail.comwrote: loop = MonadPlus m = m Bool loop = loop If we apply Just to loop as follows test2 :: MonadPlus m = m (Maybe Bool) test2 = loop = return . Just the evaluation of test2 does not terminate

[Haskell-cafe] parsing exercise

2011-01-22 Thread Sebastian Fischer
Hello, I need a function and wonder whether I can copy some existing code so I don't have to write it myself. It should split a string into a list of strings: splitAtTopLevelCommas :: String - [String] I need something similar to `splitOn ,` from the Text package with the property

Re: [Haskell-cafe] Are constructors strict?

2011-01-21 Thread Sebastian Fischer
sorry, forgot to cc cafe. On Fri, Jan 21, 2011 at 7:12 PM, Sebastian Fischer fisc...@nii.ac.jpwrote: Hi Daryoush, On Fri, Jan 21, 2011 at 6:18 AM, Daryoush Mehrtash dmehrt...@gmail.comwrote: I am having hard time understanding the following paragraph in Purely functional Lazy non

Re: [Haskell-cafe] A question about monad laws

2011-01-18 Thread Sebastian Fischer
Hi Kashyap, Could someone please help me get a better understanding of the necessity of monads complying with these laws? Maybe it helps to write them in do-notation. Once written like this, it becomes clear(er?) that do-notation would be much less intuitive if the laws would not hold: Left

Re: [Haskell-cafe] Set monad

2011-01-12 Thread Sebastian Fischer
On Sun, Jan 9, 2011 at 10:11 PM, Lennart Augustsson lenn...@augustsson.netwrote: That looks like it looses the efficiency of the underlying representation. Yes, I don't think one can retain that cleanly without using restricted monads to exclude things like liftM ($42) (mplus (return

Re: [Haskell-cafe] Set monad

2011-01-08 Thread Sebastian Fischer
On Sun, Jan 9, 2011 at 6:53 AM, Lennart Augustsson lenn...@augustsson.netwrote: It so happens that you can make a set data type that is a Monad, but it's not exactly the best possible sets. module SetMonad where newtype Set a = Set { unSet :: [a] } Here is a version that also does not

Re: [Haskell-cafe] Missing Functor instances in GHC 7?

2010-12-10 Thread Sebastian Fischer
On Fri, 2010-12-10 at 08:33 +, Simon Peyton-Jones wrote: If there's a consensus that the behaviour is wrong, or at least unexpected, would you like to make a reproducible test case and file a ticket? I took Erik's mail as indicator that the behaviour of GHCi is inconsistent and

[Haskell-cafe] Missing Functor instances in GHC 7?

2010-12-09 Thread Sebastian Fischer
Hello, according to http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Monad.html Control.Monad exports 20 Functor instance declarations in base-4.3.0.0. However: bash# ghc-pkg list | grep base base-4.3.0.0 bash# ghci --version The Glorious Glasgow Haskell

Re: [Haskell-cafe] Missing Functor instances in GHC 7?

2010-12-09 Thread Sebastian Fischer
Hi Antoine, On Thu, 2010-12-09 at 23:20 -0600, Antoine Latter wrote: Are there any particular ones you're running into problems with? Yes, I cannot find the instance for ((-) r). Even if I import Control.Monad Control.Monad.Reader Control.Applicative Data.Functor

Re: [Haskell-cafe] Missing Functor instances in GHC 7?

2010-12-09 Thread Sebastian Fischer
On Fri, 2010-12-10 at 14:35 +0900, Sebastian Fischer wrote: Yes, I cannot find the Functor instance for ((-) r). As the Applicative instance for ((-) r) depends on the Functor instance I only needed to go through the imports of Control.Applicative to find that the Functor instance of ((-) r

Re: [Haskell-cafe] Wondering if this could be done.

2010-12-04 Thread Sebastian Fischer
On Mon, 2010-11-22 at 14:48 +0800, Magicloud Magiclouds wrote: (+) :: A - A - A (+) a b = A (elem1 a + elem1 b) (elem2 a + elem2 b) -- I got errors here, for the (+) is ambiguous. That's because (+) is implicitly imported from the Prelude. If you import Prelude hiding ((+)) the error

Re: [Haskell-cafe] Equality constraint synonyms

2010-11-24 Thread Sebastian Fischer
On Thu, 2010-11-25 at 10:41 +0900, Hugo Pacheco wrote: Would this be a desired feature for other people? I'd like to have Haskell Type Constraints Unleashed http://users.ugent.be/~tschrijv/Research/papers/constraint_families.pdf which includes equality constraint synonyms. Sebastian

Re: [Haskell-cafe] Type Directed Name Resolution

2010-11-11 Thread Sebastian Fischer
On Nov 12, 2010, at 5:43 AM, Richard O'Keefe wrote: A saucepan whose handle keeps falling off is defective, I do not see TDNR as unambiguously defective as a loose saucepan handle. The amount of time spent maintaining a program is much higher than the amount of time spent creating it

Re: [Haskell-cafe] Type Directed Name Resolution

2010-11-10 Thread Sebastian Fischer
On Nov 10, 2010, at 11:57 PM, Neil Brown wrote: I wonder if special syntax is actually needed for this. How much of the language would be broken by adopting the general rule: If the only definitions of f are at the top-level or imported, find the type of 'a' and the type of all the

Re: [Haskell-cafe] ANNOUNCE: arrow-list. List arrows for Haskell.

2010-11-07 Thread Sebastian Fischer
I'm planning to write up a blog post about using list arrows for XML processing. Ok, I'll say tuned! Maybe a smaller example for the Haddock docs needs less time. Maybe this sounds weird on the Haskell mailing list, but at Silk[1] we have a full implementation of (functional reactive)

Re: [Haskell-cafe] ANNOUNCE: arrow-list. List arrows for Haskell.

2010-11-07 Thread Sebastian Fischer
to answer my own question: On Nov 7, 2010, at 8:33 PM, Sebastian Fischer wrote: Can you, for example, define a `perm` arrow that yields every permutation of it's input? Monadic implementations look like they need `=` but there may be another way.. A `perm` arrow can be defined

Re: [Haskell-cafe] What do you call Applicative Functor Morphism?

2010-11-06 Thread Sebastian Fischer
Hello, I'm curious and go a bit off topic triggered by your statement: On Nov 6, 2010, at 12:49 PM, rocon...@theorem.ca wrote: An applicative functor morphism is a polymorphic function, eta : forall a. A1 a - A2 a between two applicative functors A1 and A2 that preserve pure and * I

Re: [Haskell-cafe] Review request for my baby steps towards a platform independent interactive graphics using VNC

2010-11-06 Thread Sebastian Fischer
On Nov 4, 2010, at 3:48 PM, C K Kashyap wrote: Also, any reference/suggestion on how I could go about using a state machine to deal with the RFB protocol. A simple way to model state machines is to use one function for each state. Each function calls the functions corresponding to

Re: [Haskell-cafe] ANNOUNCE: arrow-list. List arrows for Haskell.

2010-11-06 Thread Sebastian Fischer
On Nov 6, 2010, at 10:00 PM, Sebastiaan Visser wrote: List arrows are a powerful tool when processing XML, building query languages and lots of other domains that build on functions that might return more than one value as their output. Interesting. Do you plan to write some examples that

Re: [Haskell-cafe] Is Curry alive?

2010-11-04 Thread Sebastian Fischer
On Nov 4, 2010, at 2:07 PM, wren ng thornton wrote: Besides, it's simple enough to just use the MonadLogic class and switch between concrete types, if you need to test performance. You may even try to use only `MonadPlus` to get more instances. The only instances of `MonadLogic` are

Re: [Haskell-cafe] Is Curry alive?

2010-11-02 Thread Sebastian Fischer
Hi Gregory, On Nov 2, 2010, at 9:27 AM, Gregory Crosswhite wrote: I was thinking about using Curry, but it looks to me like the language is dead and hasn't seen much activity for a few years. The community is smaller than the Haskell community but the PAKCS system is still actively

Re: [Haskell-cafe] Red links in the new haskell theme

2010-10-30 Thread Sebastian Fischer
On Oct 30, 2010, at 9:15 PM, Henning Thielemann wrote: To me it would make more sense if users could configure the colors of links in their browsers, like they configure fonts and font sizes. Most browsers support user style sheets: google.com/search?q=user+style +sheet Most people who

Re: [Haskell-cafe] Re: Monads and Functions sequence and sequence_

2010-10-29 Thread Sebastian Fischer
On Oct 30, 2010, at 2:30 PM, Mark Spezzano wrote: If you use the type with Maybe Int like so: sequence [Just 1, Nothing, Just 2] then the result is Nothing. Whereas sequence [Just 1, Just 2, Just 3] gives Just [1, 2, 3] Try do x - Just 1 y - Nothing z - Just 2

Re: [Haskell-cafe] Red links in the new haskell theme

2010-10-28 Thread Sebastian Fischer
Maybe we can keep at least the docs without red links. Pick the Classic style in the style menu. It will remember your choice. Sebastian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-10-23 Thread Sebastian Fischer
Hi Max, neat idea! Haskell supports laziness even on the type level ;) I tried to play with your code but did not get very far. I quickly ran into two problems. On Oct 22, 2010, at 7:37 PM, Max Bolingbroke wrote: The annoying part of this exercise is the the presence of a Force in the

Re: [Haskell-cafe] vector-space and standard API for vectors

2010-10-23 Thread Sebastian Fischer
On Oct 24, 2010, at 8:52 AM, wren ng thornton wrote: But then, how should we decide whether the additive or multiplicative structure is more neutral? On Oct 24, 2010, at 7:08 AM, Jacques Carette wrote: People usually use additive notation for commutative monoids, and multiplicative

Re: [Haskell-cafe] Pointed (was: Re: Restricted type classes)

2010-09-07 Thread Sebastian Fischer
On Sep 7, 2010, at 5:23 AM, wren ng thornton wrote: In particular, one of the primary complaints against the Monad class is precisely the fact that it *fails* to mention the Functor class as a (transitive) dependency. Why should we believe that making unit independent from fmap will fare

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Sebastian Fischer
On Sep 6, 2010, at 12:23 PM, Johannes Waldmann wrote: We have overloaded numerical literals (Num.fromInteger) and we can overload string literals (IsString.fromString), so how about using list syntax ( [], : ) for anything list-like (e.g., Data.Sequence)? As lists of some type A represent

Re: [Haskell-cafe] Graphics.Drawing

2010-09-06 Thread Sebastian Fischer
On Sep 6, 2010, at 1:57 PM, han wrote: So the question is: Do you agree that Graphics.Rendering.OpenGL actually should have been Graphics.OpenGL (or just OpenGL) for wieldiness? If you don't, what is your reason? I would like to know. Often, when this topic comes up, someone claims that

Re: [Haskell-cafe] overloaded list literals?

2010-09-06 Thread Sebastian Fischer
On Sep 6, 2010, at 1:47 PM, Stefan Holdermans wrote: In general, it is kind of unfortunate that type classes and type constructors share a namespace, even though there is no way to ever mix them up. Class and type names mix in im- and export lists. IIRC, this is the reason for putting

Re: [Haskell-cafe] Restricted type classes

2010-09-05 Thread Sebastian Fischer
Just because we don't have a use now doesn't mean it might not be useful in the future. I am suspicious about complicating a design for potential future benefits. However, difference lists provide an example of a type that support Pointed more naturally than Applicative: the dlist package

Re: [Haskell-cafe] Re: Crypto-API is stabilizing

2010-09-03 Thread Sebastian Fischer
[CC'ing maintainer of MonadRandom] On Sep 3, 2010, at 1:59 AM, Thomas DuBuisson wrote: data Key = Key { encrypt :: B.ByteString - B.ByteString, decrypt :: B.ByteString - B.ByteString, keyLength :: BitLength, serialize ::

Re: [Haskell-cafe] Re: Crypto-API is stabilizing

2010-09-03 Thread Sebastian Fischer
On Sep 3, 2010, at 10:40 AM, Sebastian Fischer wrote: An advantage of using a MonadRandom class would be that the CryptoAPI would be independent of RandomGen or your new alternative. One could define random monads based on either. I was wrong. The MonadRandom class uses the Random class

Re: [Haskell-cafe] Re: Crypto-API is stabilizing

2010-09-02 Thread Sebastian Fischer
On Aug 27, 2010, at 11:12 AM, Heinrich Apfelmus wrote: Is it actually necessary to use a type class here? The situation is very similar to Luke Palmer. Haskell Antipattern: Existential Typeclass. http://lukepalmer.wordpress.com/2010/01/24/ I suggest to use good old data types data

Re: [Haskell-cafe] Re: Crypto-API is stabilizing

2010-09-02 Thread Sebastian Fischer
On Sep 3, 2010, at 12:07 AM, Sebastian Fischer wrote: Why not use generateKeypair :: MonadRandom m = BitLength - m (Maybe (p,p)) Or if the choice to generate keys or not should solely depend on the BitLength (and not on the random generator): generateKeypair :: MonadRandom m

Re: [Haskell-cafe] Statically tracking validity - suggestions?

2010-09-01 Thread Sebastian Fischer
does anybody know of anything on Hackage for testing whether two values are approximately equal? http://hackage.haskell.org/package/approximate-equality -- Underestimating the novelty of the future is a time-honored tradition. (D.G.) ___

Re: [Haskell-cafe] ICFP Hotel Room

2010-08-30 Thread Sebastian Fischer
Hi Michael, I'm a graduate student (male) and am looking for a (male) roommate to split the cost of a hotel room at ICFP. [...] I currently have a reservation at the conference hotel If you don't find a roommate and can cancel your reservation you may consider staying somewhere else. For

Re: [Haskell-cafe] type classes and logic

2010-08-28 Thread Sebastian Fischer
Daniel Fischer wrote: class BEING human = HUMAN human where Sub-classing is logical implication BEING(human) = HUMAN(human) All types t that make BEING(t) = true also make HUMAN(t)=true No, it's the other way round. Every HUMAN is also a BEING, hence HUMAN(t) = BEING(t) Could I say that

Re: [Haskell-cafe] type classes and logic

2010-08-27 Thread Sebastian Fischer
Hi Pat, A proof for the predicate BEING(being) must show that there is an inhabited type (a type which has values) Note that in a lazy language like Haskell every type is inhabited by _| _, that is, bottom the undefined value. If we find a value for a type that is a proof that a type

Re: [Haskell-cafe] Simple Sudoku solver using Control.Monad.Logic

2010-08-23 Thread Sebastian Fischer
a brief introduction to nondeterminism monads in general and how to implement some specific instances: On Functional-Logic Programming and its Application to Testing by Sebastian Fischer Section 5.1, Nondeterminism monads http://www-ps.informatik.uni-kiel.de/~sebf/thesis.pdf

Re: [Haskell-cafe] Question about memory usage

2010-08-18 Thread Sebastian Fischer
Hi John, You could try: [...] It allocates less and has a smaller maximum residency: (ghc 6.12.2,windows 7 64) 292,381,520 bytes allocated in the heap 13,020,308 bytes maximum residency (8 sample(s)) 99 MB total memory in use (9 MB lost due to fragmentation) MUT

Re: [Haskell-cafe] Question about memory usage

2010-08-17 Thread Sebastian Fischer
On Aug 17, 2010, at 12:33 AM, Jason Dagit wrote: So next I would use heap profiling to find out where and what type of data the calculation is using. I did. I would do heap profiling and look at the types. All retained data is of type ARR_WORDS. Retainer profiling shows that the

Re: [Haskell-cafe] Question about memory usage

2010-08-17 Thread Sebastian Fischer
On Aug 17, 2010, at 8:39 AM, Roel van Dijk wrote: That is an interesting trick. So there exists an algorithm that calculates Fibonacci numbers in O(log n) time. This is what my program does. But it's only O(long n) if you assume multiplication is constant time (which it is not for large

Re: [Haskell-cafe] Question about memory usage

2010-08-17 Thread Sebastian Fischer
BTW, what sort of memory usage are we talking about here? I was referring to the memory usage of this program import System.Environment import Data.Numbers.Fibonacci main :: IO () main = do n - (read . head) `fmap` getArgs (fib n :: Integer) `seq` return ()

[Haskell-cafe] ANN: primes-0.2.0.0

2010-08-16 Thread Sebastian Fischer
Hello, I have uploaded new versions of the primes package to Hackage: http://hackage.haskell.org/package/primes Version 0.2.0.0 significantly improves the memory requirements (and as a result also the run time) compared to 0.1.1. The run time is now almost linear and when streaming an

Re: [Haskell-cafe] Question about memory usage

2010-08-16 Thread Sebastian Fischer
[continuing off topic] On Aug 16, 2010, at 3:13 PM, Daniel Fischer wrote: You can calculate the n-th Fibonacci number in O(log n) steps using Integer arithmetic to get correct results. Yes, I was delighted when I saw this for the frist time. It works be computing /1 1\^n \1 0/

Re: [Haskell-cafe] Question about memory usage

2010-08-16 Thread Sebastian Fischer
[CC-ing café again] On Aug 16, 2010, at 5:52 PM, Daniel Fischer wrote: I am a bit concerned about the memory usage. Of your implementation of the matrix power algorithm? Yes. Making the fields of Matrix strict should help: data Matrix a = Matrix !a !a !a Making all fields strict

Re: [Haskell-cafe] Is bumping the version number evil, if it's not mandated by the PVP?

2010-08-15 Thread Sebastian Fischer
Hello, On Aug 14, 2010, at 12:43 PM, Ross Paterson wrote: When bumping only a.b.c.D, the new version is not installed as a dependency if the old version already is installed (unless the new version is explicitly demanded.) It seems bumping a.b.c.D has advantages for some users and

Re: [Haskell-cafe] Is bumping the version number evil, if it's not mandated by the PVP?

2010-08-15 Thread Sebastian Fischer
My worry with bumping only the patch level is that people who explicitly want to depend on the efficient version of my library need to depend on a.b.c.D and cannot follow the good practice of depending on a.b.*. Well, then you have = a.b.c.d a.(b+1). Ok, it seems this is less of an issue

[Haskell-cafe] Is bumping the version number evil, if it's not mandated by the PVP?

2010-08-14 Thread Sebastian Fischer
Hello, I wonder whether (and how) I should increase the version number of a library when the API does not change but the implementation gets more efficient. Should I bump a.b.C or even a.B to signal that it's worth using the new version or should I bump only a.b.c.D such that packages

Re: [Haskell-cafe] Is bumping the version number evil, if it's not mandated by the PVP?

2010-08-14 Thread Sebastian Fischer
[CC'ing café again] On Aug 14, 2010, at 12:25 PM, Max Rabkin wrote: On Sat, Aug 14, 2010 at 11:13 AM, Sebastian Fischer s...@informatik.uni-kiel.de wrote: Hello, I wonder whether (and how) I should increase the version number of a library when the API does not change but the implementation

Re: [Haskell-cafe] A GHC error message puzzle

2010-08-12 Thread Sebastian Fischer
Give a definition for process and an input file that reproduce this result. Quite probably not the intended solution: process :: String - String process _ = error output: hClose: illegal operation (handle is finalized) Have fun! Sebastian -- Underestimating the novelty of the

  1   2   >