Re: [Haskell-cafe] Re: [Hs-Generics] how to automatically create and install documentations of a package?

2009-09-27 Thread Michael Shulman
Andy Gimblett wrote: Is there a way to make it automatically update a single contents page with links to the documentation of all installed packages? See: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/53531/focus=53560

Re: [Haskell-cafe] Re: [Hs-Generics] how to automatically create and install documentations of a package?

2009-09-19 Thread Michael Shulman
Gwern Branwen wrote: If you use cabal-install (as you should!), you can have it build haddocks by customizing ~/.cabal/config and adding: documentation: True Is there a way to make it automatically update a single contents page with links to the documentation of all installed packages? I

Re: Proposal for stand-alone deriving declarations?

2006-10-06 Thread Michael Shulman
On 10/6/06, John Hughes [EMAIL PROTECTED] wrote: deriving (Eq Foo, Ord Foo) instead of deriving (Eq, Ord) for Foo So what does newtype Foo a = Foo a newtype Bar b = Bar b class C a b deriving (C (Foo a) (Bar b)) mean? I could see it meaning any or all of the following: instance (C (Foo

[Haskell-cafe] Having our cake and eating it too

2006-10-05 Thread Michael Shulman
This proposal is somewhat tongue in cheek, but at least it's amusing, and who knows, it might be good for something. The idea is that one could, in theory, allow both prefix unary minus and right sections of subtraction, with the type-checker deciding which is meant based on the context. Has

Re: [Haskell-cafe] cumulative sum

2006-10-02 Thread Michael Shulman
On 10/2/06, Tamas K Papp [EMAIL PROTECTED] wrote: Hi, I have two lists, p and lambda (both are finite). I would like to calculate 1) the cumulative sum of lambda, ie if lambda = [lambda1,lambda2,lambda3,...] then csum lambda = [lambda1,lambda1+lambda2,lambda1+lambda2+lambda3,...] Try

[Haskell-cafe] Re: Typeclass vs. Prolog programming

2006-09-28 Thread Michael Shulman
Thank you Oleg! That explanation is very clear. On 9/28/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The typechecker commits to the instance and adds to the current constraints TypeCast x Int, Ord Bool, Eq Bool The latter two are obviously satisfied and so discharged. The former

[Haskell-cafe] Re: variadic functions and typeCast

2006-09-27 Thread Michael Shulman
On 9/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: First of all, there is a version of TypeCast that works within the same module, please see any code described in http://pobox.com/~oleg/ftp/Haskell/typecast.html Yes, I was aware of that; I gave the shorter version just because

Re: [Haskell-cafe] Re: [Haskell] MR details (was: Implicit type of numeric constants)

2006-09-23 Thread Michael Shulman
On 9/23/06, Bernie Pope [EMAIL PROTECTED] wrote: If a pattern binding is not simple, it must have a data constructor on the lhs, therefore it cannot be overloaded. So the (dreaded) MR only applies to simple pattern bindings. I thought it was simple pattern bindings that could be *exempted*

[Haskell-cafe] variadic functions and typeCast

2006-09-23 Thread Michael Shulman
Hi all, I am writing, for my own amusement, a more general version of the trick to implement variadic functions in Haskell outlined at http://okmij.org/ftp/Haskell/vararg-fn.lhs. (If someone else has done this already, please point me to it!) Code is attached at the end of the message. My

Re: [Haskell] How to define Y combinator in Haskell

2006-09-15 Thread Michael Shulman
On 9/15/06, Robert Dockins [EMAIL PROTECTED] wrote: You can define a direct fixed point combinator without relying on nominal recursion in Haskell, but it requires you to define a helper newtype. That's really nifty! I'd been wondering whether you could do this too. Is there a reason for the

Re: [Haskell-cafe] Re: evaluate vs seq

2006-09-14 Thread Michael Shulman
On 9/14/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: With this in mind the equations 1) return _|_ == Return _|_ 2) _|_ `seq` (return _|_) == _|_ can be interpreted: 1) when reducing a return-redex (i.e. evaluating it), we get weak-head normal form without evaluating the argument

Re: [Haskell-cafe] Re: evaluate vs seq

2006-09-13 Thread Michael Shulman
On 9/13/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: So `seq` forces its first argument. When we define f x = x `seq` (Return x) we thereby get f _|_== _|_ f [] == Return [] f (x:xs) == Return (x:xs) To compare, the semantics of (evaluate) is evaluate _|_== ThrowException

Re: [Haskell-cafe] foreach

2006-09-13 Thread Michael Shulman
On 9/13/06, Henning Thielemann [EMAIL PROTECTED] wrote: If you want more sugar, what about the list monad? main = do args - getArgs sequence_ $ do arg - args n - [1..3] return (putStrLn $ show n ++ ) ++ arg) Or, what about using ListT

Re: [Haskell-cafe] MonadList?

2006-09-13 Thread Michael Shulman
On 9/13/06, Bertram Felgenhauer [EMAIL PROTECTED] wrote: Michael Shulman wrote: class MonadList m where option :: [a] - m a [...] There's no need for an extra class, it can be done with MonadPlus: option :: MonadPlus m = [a] - m a option = msum . map return But this doesn't always give

Re: [Haskell-cafe] Re: evaluate vs seq

2006-09-10 Thread Michael Shulman
On 9/10/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: The GHC documentation says that (evaluate a) is not the same as (a `seq` return a). Can someone explain the difference to me, or point me to a place where it is explained? (evaluate a) is weaker than (a `seq` return a). (a `seq` return

[Haskell-cafe] sections of noncommutative operators

2006-09-09 Thread Michael Shulman
A propos of sections of subtraction, and thence to sections of other noncommutative operators, as a Haskell newbie I was surprised to discover (the hard way!) that ( 0) and (() 0) mean different things. I had typed ( 0) when I meant to type (() 0). No compiler errors, of course, and I had a

Re: [Haskell-cafe] Re: sections of noncommutative operators

2006-09-09 Thread Michael Shulman
No, lisp doesn't have currying, but of course I knew that Haskell does. I think my thought processes went something like this: I want to partially apply , but is an infix operator in Haskell, so first I have to convert it to the function () written with prefix notation and then partially apply

Re: [Haskell-cafe] Re: sections of noncommutative operators

2006-09-09 Thread Michael Shulman
On 9/9/06, Brian Hulley [EMAIL PROTECTED] wrote: Yes: tuples, contexts, set of classes to derive from in a deriving clause, module export list, import directives. I guess I thought of most of those as a sort of grouping, without really thinking about it. But I suppose you are right that they

[Haskell-cafe] evaluate vs seq

2006-09-09 Thread Michael Shulman
The GHC documentation says that (evaluate a) is not the same as (a `seq` return a). Can someone explain the difference to me, or point me to a place where it is explained? Mike ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org