Re: [Haskell-cafe] First time haskell - parse error!

2010-03-10 Thread Sebastian Fischer
On Mar 10, 2010, at 8:47 AM, Ketil Malde wrote: I think it is better style to avoid this kind of one-off named values. I much prefer: then Golds ++show (gold s g)++... For some reason, this is a style isse that doesn't get much attention At the end of the Section on function

Re: [Haskell-cafe] First time haskell - parse error!

2010-03-10 Thread Sebastian Fischer
On Mar 10, 2010, at 12:21 PM, Ketil Malde wrote: Introducing names means that I need to keep the temporary definitions in my head, and I think takeWhile (1) is as clear as it can get. And while a name can be misleading (belowLimit is a boolean, no?) or flat out wrong, the definition has

Re: [Haskell-cafe] Functional Dependencies conflicts

2010-04-18 Thread Sebastian Fischer
On Apr 18, 2010, at 11:01 AM, Limestraël wrote: It's strange I can't declare a generic instance for Binary types... I thought I was trying to do something quite common in Haskell. A common workaround is to define a newtype like this newtype GenericBinary a = GB { fromGB :: a } and an

[Haskell-cafe] Re: [Haskell] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Sebastian Fischer
Hello Christian, On Apr 19, 2010, at 4:48 PM, Christian Maeder wrote: I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan Feedback is welcome. I get lots of multiple blanks which I'd rather not correct. I often use multiple blanks to achieve vertical

Re: [Haskell-cafe] Re: [Haskell] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Sebastian Fischer
I wrote: I did not find a way to configure scan to ignore multiple blanks. The poor man's solution is to pipe the output through grep --invert-match --regexp=multiple ([0-9]*) blanks I agree with Henning about the hyphen option. This often (usually?) means don't read from a file but

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Sebastian Fischer
Furthermore, as I said earlier, it doesn't make sense to constrain the label type just to make an instance of a type class. (Now, if we had other functions in there which _might_ depend on the label types, this _would_ make sense; as it stands however, it doesn't.) You'll notice that my

Re: [Haskell-cafe] FGL instance constraint

2010-05-01 Thread Sebastian Fischer
On May 1, 2010, at 8:08 AM, Ivan Lazar Miljenovic wrote: * I can't redefine the Graph methods to introduce the (Cls a) constraint [reasonable] Not sure if you can. I think Kevin means that he cannot change the signature of the methods in the Graph class because those are defined in the

Re: [Haskell-cafe] profiling uniplate

2010-05-01 Thread Sebastian Fischer
I guess I either need to install profiling libraries for uniplate, or disable profiling of those functions coming from uniplate. Exactly. For the former cabal install --reinstall --enable-library-profiling uniplate should do the trick. Sebastian -- Underestimating the novelty of the

Re: [Haskell-cafe] MonadPlus or Alternative or ...?

2010-05-02 Thread Sebastian Fischer
On May 2, 2010, at 1:11 AM, Sean Leather wrote: I want to generalize a set of functions from lists to some functor type. [...] Should I choose MonadPlus and use these? [...] Or should I choose Alternative and use these? [...] There are some types that can be an instance of Alternative but

Re: [Haskell-cafe] MonadPlus or Alternative or ...?

2010-05-02 Thread Sebastian Fischer
On May 2, 2010, at 11:10 AM, Sean Leather wrote: Or should I make my own class? Then, there obviously won't be any instances for existing types other than your own (which might be a good or bad thing). You may want to do this, if you don't want to require either (=) or (*), which may

Re: [Haskell-cafe] MonadPlus or Alternative or ...?

2010-05-02 Thread Sebastian Fischer
would you have any suggestions on a name for such a class or names for the methods? I'm afraid I don't. I'd like class Pointed t where point :: a - t a class Monoid m where id :: m (.) :: m - m - m constraint Monoidy t = (Pointed t, Monoid (t a)) (although

Re: [Haskell-cafe] Haskell and the Software design process

2010-05-02 Thread Sebastian Fischer
On May 3, 2010, at 6:35 AM, Alexander Dunlap wrote: Of course, there are situations where it is really awkward to not use partial functions, basically because you *know* that an invariant is satisfied That falls under Don's: Use types to encode the design into a machine checkable form Or

[Haskell-cafe] Different choice operations in a continuation monad

2010-06-15 Thread Sebastian Fischer
Dear Café, `MonadPlus` instances are usually required to satisfy certain laws, among them the monad laws and monoid laws for `mzero` and `mplus`. Additionally one may require that (=f) is a monoid morphism, that is: mzero = f = mzero (a `mplus` b) = f = (a = f)

Re: [Haskell-cafe] Different choice operations in a continuation monad

2010-06-15 Thread Sebastian Fischer
Hello Holger, Can you define an associative operation orElse :: CMaybe r a - CMaybe r a - CMaybe r a with identity `mzero` that satisfies the cancellation law? No, because that function would need to cancel values of type a, but the arguments of type (CMaybe r a) can only compute values

Re: [Haskell-cafe] Different choice operations in a continuation monad

2010-06-15 Thread Sebastian Fischer
On Jun 15, 2010, at 6:11 PM, Sebastian Fischer wrote: orElse :: CMaybe a a - CMaybe a a - CMaybe r a CMaybe ca `orElse` CMaybe cb = CMaybe (\k - (ca return `mplus` cb return) = k) Good point. But with this restricted type `orElse` is less useful. For example, one cannot compute

Re: [Haskell-cafe] Re: Different choice operations in a continuation monad

2010-06-16 Thread Sebastian Fischer
Heinrich Apfelmus wrote: Sebastian Fischer wrote: I still don't understand why it is impossible to provide `orElse` with the original type. I will think more about the reason you gave. The reason is that you have chosen the wrong type for your continuation monad; it should be newtype

[Haskell-cafe] Re: Different choice operations in a continuation monad

2010-06-18 Thread Sebastian Fischer
Edward Kmett wrote: Sebastian Fischer wrote: Heinrich Apfelmus wrote: newtype CMaybe a = CMaybe (forall r. (a - Maybe r) - Maybe r) Yes, with this type `orElse` has the same type as `mplus`, which is very nice. This type is the same as Codensity Maybe using category-extras which is a 'bit

Re: [Haskell-cafe] Re: Different choice operations in a continuation monad

2010-06-18 Thread Sebastian Fischer
On Jun 18, 2010, at 8:55 PM, Heinrich Apfelmus wrote: I wonder whether for every monad `m` and `a :: Codensity m a` getCodensity a f = getCodensity a return = f Is this true? Why (not)? It's not true. What a pity! An example that is not generic in the base monad m , i.e. that

Re: [Haskell-cafe] Re: Different choice operations in a continuation monad

2010-06-22 Thread Sebastian Fischer
On Jun 19, 2010, at 1:48 PM, Heinrich Apfelmus wrote: In my code, mzero is indeed an identity for orElse [...] The observation is any action can be brought into one of the forms mzero return a `mplus` return b `mplus` ... which corresponds to the list type [a] . Ok that makes sense

[Haskell-cafe] Re: The mother of all functors/monads/categories

2010-06-27 Thread Sebastian Fischer
Hi Max, very interesting observations! By the way, you can use this stuff to solve the restricted monad problem (e.g. make Set an instance of Monad). This is not that useful until we find out what the mother of all MonadPlus is, though, because we really need a MonadPlus Set instance. I'm

[Haskell-cafe] Re: ANNOUNCE: HaRe, the Haskell Refactorer 0.6

2010-06-29 Thread Sebastian Fischer
Hello Chris, Chris Brown wrote: we are pleased to announce the availability of HaRe 0.6 Great, I want to try it! While skimming the installation instructions I wondered why I couldn't just do cabal install HaRe Are there any problems with putting HaRe on Hackage? I will probably

[Haskell-cafe] Re: ANNOUNCE: HaRe, the Haskell Refactorer 0.6

2010-06-29 Thread Sebastian Fischer
Chris Brown wrote: Are there any problems with putting HaRe on Hackage? I've looked at this before and I must say it's certainly not trivial to do this. [...] We also need to have vim and emacs scripts available to the user after the install. The ghc-mod package [1] provides emacs

Re: [Haskell-cafe] bounded ranges

2010-07-22 Thread Sebastian Fischer
On Jul 23, 2010, at 12:21 AM, Chad Scherrer wrote: bdRangeSize :: (Ix i, Bounded i) = i - Int bdRangeSize _ = rangeSize (minBound, maxBound :: i) Unlike intended, the `i` in the type annotation to `maxBound` is not the same as the `i` in the signature of `bdRangeSize`. You need to enable

Re: [Haskell-cafe] bounded ranges

2010-07-22 Thread Sebastian Fischer
An alternative to the `asTypeOf` idiom, which is also Haskell 98, is to use a newtype instead of a dummy argument: newtype RangeSize i = RangeSize { getRangeSize :: Int } boundedRangeSize :: Ix i = (i,i) - RangeSize i boundedRangeSize = RangeSize . rangeSize bdRangeSize ::

Re: [Haskell-cafe] Please report any bug of gtk2hs-0.11.0!

2010-07-26 Thread Sebastian Fischer
Hello, On Jul 13, 2010, at 9:15 AM, Andy Stewart wrote: Please report any bug of gtk2hs-0.11.0, we will fix it before release gtk2hs-0.11.1 I have just installed the new Haskell Platform under Mac OS X 10.5. With the previous installation of GHC 6.10.4 I managed to install gtk2hs

[Haskell-cafe] ANN: weighted-regexp-0.1.0.0

2010-07-26 Thread Sebastian Fischer
Hello, this year's ICFP features A Play on Regular Expressions where two Haskell programmers and an automata theory guru develop an efficient purely functional algorithm for matching regular expressions. A Haskell library based on their ideas is now available from Hackage. For more

Re: [Haskell-cafe] Please report any bug of gtk2hs-0.11.0!

2010-07-26 Thread Sebastian Fischer
On Jul 26, 2010, at 6:59 PM, Andy Stewart wrote: cabal install gtk fails with the message Configuring gtk-0.11.0... setup: ./Graphics/UI/Gtk/General/IconTheme.chs: invalid argument cabal: Error: some packages failed to install: gtk-0.11.0 failed during the building phase. The

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-26 Thread Sebastian Fischer
Hi Sjoerd, It seems that only shift needs the reg field of the RegW datatype. So you can also replace the reg field with a shift field. This makes the regexp parser extensible, as there is no longer a dependence on the (closed) datatype Reg: data RegW w c = RegW { active :: !Bool,

Re: [Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-26 Thread Sebastian Fischer
On Jul 27, 2010, at 6:57 AM, Sebastian Fischer wrote: Maybe I'll add it [noMatch] to the next version. I only need a better string representation ;) Ha! It's already provided by character classes: ghci accept (fromString []) abc False I'll add noMatch :: RegExp c noMatch

[Haskell-cafe] ANN: weighted-regexp-0.1.1.0

2010-07-27 Thread Sebastian Fischer
I have released weighted-regexp-0.1.1.0 with two additional combinators: -- | Does not match anything. 'noMatch' is an identity for 'alt'. -- noMatch :: RegExp c -- | -- Matches a sequence of the given regular expressions in any -- order. For example, the regular

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-27 Thread Sebastian Fischer
On Jul 27, 2010, at 9:15 AM, Sjoerd Visscher wrote: Oh, by the way, with noMatch, eps, alt and seq_ RegExp is itself a Semiring, Yes, but it's hard to define an Eq instance for arbitrary regular expressions that reflects equivalence of regexps. There is currently only `instance Eq

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Sebastian Fischer
Have you thought about supporting anchors like (^) and ($) ? We went the opposite route, made full matching the default, and implemented partial matching by pre- and appending .* As there are both a fullMatch and a partialMatch function, I don't see an immediate need for anchors, although

[Haskell-cafe] ANN: weighted-regexp-0.2.0.0

2010-07-28 Thread Sebastian Fischer
I have uploaded version 0.2.0.0 of the weighted-regexp package for weighted regular expression matching to Hackage. The changes are briefly 0.2.0.0 More general types for matching functions Renamed accept to acceptFull, added acceptPartial Strict numeric semiring SPECIALIZE pragmas

Re: [Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Sebastian Fischer
Oh, by the way, with noMatch, eps, alt and seq_ RegExp is itself a Semiring, Yes, but it's hard to define an Eq instance for arbitrary regular expressions that reflects equivalence of regexps. How hard is this exactly? The standard algorithm to decide regexp equivalence transforms both

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-28 Thread Sebastian Fischer
REG_NEWLINE Compile for newline-sensitive matching. By default, newline is a completely ordinary character with no special meaning in either REs or strings. With this flag, `[^' bracket expressions and `.' never match newline, a `^' anchor matches the null string after any newline in the

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-29 Thread Sebastian Fischer
Maybe even write a blog about how it works? A whole blog is probably unnecessary ;) But a blog *post* would be nice! -- Underestimating the novelty of the future is a time-honored tradition. (D.G.) ___ Haskell-Cafe mailing list

[Haskell-cafe] Re: ANN: weighted-regexp-0.1.0.0

2010-07-29 Thread Sebastian Fischer
Hello Chris, thanks for the examples. They show that by adding anchors, the meaning of regular expressions is no longer compositional. For example (^|a) accepts the empty word only if no characters have been read yet. So (^|a) =~ does hold but a(^|a) =~ a does not hold

Re: [Haskell-cafe] What's this pattern called?

2009-10-22 Thread Sebastian Fischer
Hi Martijn, On Oct 22, 2009, at 9:47 AM, Martijn van Steenbergen wrote: I've heard fixed-point view, open datatypes and some others, but I'm curious where this pattern comes up in literature and what it is called there. Tim Sheard and Emir Pasalic call this technique two-level types in

Re: [Haskell-cafe] haskell-src-exts Question

2009-11-16 Thread Sebastian Fischer
Hello, On Nov 13, 2009, at 11:54 PM, Niklas Broberg wrote: But the problem at hand here is auto-generated AST code, where we cannot rely on the parser to do the right thing. There's help in the AST such that it's possible to explicitly insert brackets where needed, but I agree with Dominic

[Haskell-cafe] namespaces for values, types, and classes

2009-11-27 Thread Sebastian Fischer
Dear Café, types and values are in separate namespaces. So, we can write data Name = Name where the first `Name` is a type and the second is a value. However, classes are in the same namespace as types. We cannot write class Name a where ... instance Name Name where ...

Re: [Haskell-cafe] namespaces for values, types, and classes

2009-11-28 Thread Sebastian Fischer
Does anyone know why types and values are in separate namespaces but classes and types are not? I think it's because you cannot currently distinguish them in module import/exports. Ah, good point. For constructors there is special syntax which allows to distinguish them in im/exports. Even

[Haskell-cafe] Typed Configuration Files

2010-01-08 Thread Sebastian Fischer
Dear Café, Neil Mitchell's cmdargs package [1] is pretty neat. It can be used to parse command-line arguments into a user-defined data structure. Is there something similar for parsing config files? There are a number of config file parsers on Hackage. But even the most sophisticated one

Re: [Haskell-cafe] Typed Configuration Files

2010-01-10 Thread Sebastian Fischer
Is there something similar for parsing config files? If you write one I most certainly will use it! ;) You (we) can already start using the cmdargs package to parse config files. Upon my feature request to add a function to the cmdargs package that allows to add default arguments, Neil

[Haskell-cafe] short licensing question

2010-01-11 Thread Sebastian Fischer
Hello Café, when writing a Haskell library that uses two other Haskell libraries -- one licensed under BSD3 and one under LGPL -- what are allowed possibilities for licensing the written package? PublicDomain? BSD3? LGPL? Sebastian -- Underestimating the novelty of the future is a

Re: [Haskell-cafe] short licensing question

2010-01-11 Thread Sebastian Fischer
On Jan 11, 2010, at 2:08 PM, Don Stewart wrote: Libraries don't link in other things as such -- the .cabal file is the only thing that ties them together -- so you can use whatever license you like. On Jan 11, 2010, at 7:02 PM, Tom Tobin wrote: I think in your case you can license the

Re: [Haskell-cafe] short licensing question

2010-01-12 Thread Sebastian Fischer
On Jan 12, 2010, at 1:38 PM, Duncan Coutts wrote: But that is the intent of the LGPL, to protect the rights of the users *receiving* the code, not to guarantee that modifications are available to the entire world. I wonder whether the following statements are valid: When I write a

Re: [Haskell-cafe] short licensing question

2010-01-12 Thread Sebastian Fischer
On Jan 12, 2010, at 8:46 PM, Sebastian Fischer wrote: Am I allowed to distribute the sources under BSD3 and the binary under LGPL? Would that make sense? Maybe not, because anyone who distributes a binary of my program or derivative work must license it under LGPL anyway. Well it may

Re: [Haskell-cafe] How to fulfill the code-reuse destiny of OOP?

2010-01-13 Thread Sebastian Fischer
On Jan 13, 2010, at 11:00 AM, Sittampalam, Ganesh wrote: Type classes allow you to dispatch based on return type, and on the instantiations of generic parameters. Neither of these things is reasonably possible with interfaces. There is recent work that generalises the capabilities of

Re: [Haskell-cafe] wildcards for type variables?

2010-01-13 Thread Sebastian Fischer
On Jan 13, 2010, at 2:16 PM, Antoine Latter wrote: He's looking for the self-documentation aspect of this argument is completely irrelevant. Neither rolling a random unused type variable nor foralling it (my first idea) really accomplishes that. Isn't that what we have here? a function

Re: [Haskell-cafe] wildcards for type variables?

2010-01-13 Thread Sebastian Fischer
On Jan 13, 2010, at 6:54 PM, Evan Laforge wrote: It's not a big issue, but it seemed like a nice symmetry with pattern matching syntax. And I don't think it's a weird idea. The Haskell dialect Curry [1] supports this syntax. Maybe the hurdle for Haskell is the competition with more

Re: [Haskell-cafe] Hierachical abstraction

2010-01-28 Thread Sebastian Fischer
On Jan 28, 2010, at 9:31 PM, Luke Palmer wrote: I don't remember the name, but there is a technique where you compose the features you want and then take its fixed point to get your AST. Did you think of Data types à la carte by Wouter Swierstra?

Re: [Haskell-cafe] Strange random choice algorithm

2010-01-30 Thread Sebastian Fischer
On Jan 30, 2010, at 8:59 PM, michael rice wrote: I'm not sure where I got this PICK function from, and don't understand why it's written as it is, so I wanted to test it for randomness. It seems random enough. We can convince ourselves using reason instead of tests. An element is

Re: [Haskell-cafe] Strange random choice algorithm

2010-01-31 Thread Sebastian Fischer
On Jan 31, 2010, at 12:06 AM, Sebastian Fischer wrote: pick xs = do n - randomRIO (1,length xs) return (xs!!(n-1)) would have been clearer.. It queries the random number generator only once but walks through the list twice. Walking through the list twice leads to linear

Re: [Haskell-cafe] Stack ADT?

2010-02-04 Thread Sebastian Fischer
On Feb 4, 2010, at 6:07 PM, michael rice wrote: Can't find a Stack datatype on Hoogle? Where should I look? Could not find one on Hackage either. Probably because its so easy to handcraft your own: newtype Stack a = Stack [a] emptyStack = Stack [] isEmptyStack (Stack xs) =

Re: [Haskell-cafe] Stack ADT?

2010-02-04 Thread Sebastian Fischer
On Feb 4, 2010, at 6:27 PM, michael rice wrote: I haven't done much with modules so I'm guessing what you've provided is the guts of StackImpl, to hide the implementation? Right. In order to make the Stack type abstract, you can hide the Stack data (that is, newtype) constructor and only

[Haskell-cafe] lazy'foldl

2010-02-10 Thread Sebastian Fischer
Hello, I have implemented the following function: lazy'foldl :: (a - b - Maybe a) - Maybe a - [b] - Maybe a lazy'foldl _ Nothing _ = Nothing lazy'foldl _ m[] = m lazy'foldl f (Just y) (x:xs) = lazy'foldl f (f y x) xs After hoogling its type, I found that

Re: [Haskell-cafe] What are free Monads?

2010-03-02 Thread Sebastian Fischer
On Mar 2, 2010, at 5:59 AM, Dan Doel wrote: http://haskell.org/haskellwiki/Free_monad http://haskell.org/haskellwiki/Free_structure Nice, thank you for writing this. Feel free to make suggestions/changes. I enjoyed reading it although Section 3 is challenging for people (like me)

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

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

2010-08-12 Thread Sebastian Fischer
Wei Hu wrote: nonTermination _ = blackhole where blackhole = blackhole My original example was actually: process :: String - String process = let x = x in x process = process works just as well. What about the other part of the solution: What is the cause of the error? Of course,

[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] 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] 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] 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 ()

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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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-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] 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] 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] 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] 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] 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] 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] 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] 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

  1   2   >