Re: [Haskell-cafe] some questions about Template Haskell

2013-06-30 Thread oleg
TP wrote: > pr :: Name -> ExpQ > pr n = [| putStrLn $ (nameBase n) ++ " = " ++ show $(varE n) |] The example is indeed problematic. Let's consider a simpler one: > foo :: Int -> ExpQ > foo n = [|n + 1|] The function f, when applied to an Int (some bit pattern in a machine register), produces _c

Re: [Haskell-cafe] Subclass or no subclass?

2013-06-30 Thread Patrick Browne
As you say if I omit references to superclass methods in the subclasses then I get different compile time behaviour.But then the question is that if a putative subclass has no reference to superclass methods should it be a subclass at all?I deliberately want to model the case where each subclass de

Re: [Haskell-cafe] Subclass or no subclass?

2013-06-30 Thread Dan Burton
> > I am not trying to say "every building is a shelter", rather "anything > that is a building must provide sheltering services". Well if it walks like a shelter and quacks like a shelter... /shrug The "is a" relationship is not a good way to think about type classes, in my opinion. The "interf

Re: [Haskell-cafe] Subclass or no subclass?

2013-06-30 Thread Richard Eisenberg
It sounds like the following example may help: > class A alpha where > a :: alpha -> Int > > class A beta => B beta where > b :: beta -> Int > > class C gamma where > c :: gamma -> Int > > foo :: B beta => beta -> Int > foo x = a x + b x > -- the (A beta) is implied by the superclass constra

Re: [Haskell-cafe] Subclass or no subclass?

2013-06-30 Thread Patrick Browne
Richard,Yes, that example makes things clear.Thanks,PatOn 30/06/13, Richard Eisenberg wrote:It sounds like the following example may help:> class A alpha where>   a :: alpha -> Int>> class A beta => B beta where>   b :: beta -> Int>> class C gamma where>   c :: gamma -> Int>> foo :: B beta => bet

Re: [Haskell-cafe] some questions about Template Haskell

2013-06-30 Thread TP
o...@okmij.org wrote: >> pr :: Name -> ExpQ >> pr n = [| putStrLn $ (nameBase n) ++ " = " ++ show $(varE n) |] > > The example is indeed problematic. Let's consider a simpler one: > >> foo :: Int -> ExpQ >> foo n = [|n + 1|] > > The function f, when applied to an Int (some bit pattern in a mach

[Haskell-cafe] question about indentation conventions

2013-06-30 Thread Richard Cobbe
I hope I'm not starting a holy war with this, but I'm curious about an aspect of coding style that's been bugging me for a while, and I'm not finding much discussion of this question on the web or in the mailing list archives. Two questions: 1) Are there wide-spread conventions in the Haskell com

Re: [Haskell-cafe] some questions about Template Haskell

2013-06-30 Thread John Lato
On Mon, Jul 1, 2013 at 6:01 AM, TP wrote: > o...@okmij.org wrote: > > >> pr :: Name -> ExpQ > >> pr n = [| putStrLn $ (nameBase n) ++ " = " ++ show $(varE n) |] > > > > The example is indeed problematic. Let's consider a simpler one: > > > >> foo :: Int -> ExpQ > >> foo n = [|n + 1|] > > > > The

Re: [Haskell-cafe] question about indentation conventions

2013-06-30 Thread Darren Grant
Hi Richard, This page helped me when starting out: http://en.wikibooks.org/wiki/Haskell/Indentation On 2013-06-30 4:55 PM, "Richard Cobbe" wrote: > I hope I'm not starting a holy war with this, but I'm curious about an > aspect of coding style that's been bugging me for a while, and I'm not > fi

Re: [Haskell-cafe] question about indentation conventions

2013-06-30 Thread Richard Cobbe
On Sun, Jun 30, 2013 at 05:41:46PM -0700, Darren Grant wrote: > Hi Richard, > > This page helped me when starting out: > http://en.wikibooks.org/wiki/Haskell/Indentation > On 2013-06-30 4:55 PM, "Richard Cobbe" wrote: > > 1) Are there wide-spread conventions in the Haskell community for how to

Re: [Haskell-cafe] question about indentation conventions

2013-06-30 Thread Patrick Mylund Nielsen
The Haskell Style Guide is quite popular: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md (accompying elisp module: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.el) I am not sure what the verdict is on functions spanning multiple lines, other tha

Re: [Haskell-cafe] question about indentation conventions

2013-06-30 Thread Richard A. O'Keefe
On 1/07/2013, at 1:04 PM, Richard Cobbe wrote: > > I should have been clearer in my original question: I'm curious about what > to do when a multi-argument function application gets split across lines. > That wiki page dicsusses how the layout rule interacts with various special > forms (let, whe