
Emil, Felipe, Thanks. I don't know Type Families, but take the point that the input can be parameterised with something something other than a list. i.e. (8 :+: 4 :+: 2 :+: ()) presumably has the same type as (4 :+: 2 :+: ()). My intention was to use common list functions on the sublists, but always then a concat for each level, to return to a flat list. With that in mind I made the following oddity, which in any case doesn't compile due to its use of infinite types. app (f:fs) es = appUp (f:fs) es where len = genericLength (f:fs) appUp [] es = appDown es len appUp (f:fs) es = appUp (map map fs) (f es) appDown es len = appDown (concat es) (len - 1) appDown es 0 = es Henning, I agree with you, a tree would be much better for this. Thanks. -Paul

On Thu, Jun 04, 2009 at 05:09:29PM +0100, Paul Keir wrote:
Thanks. I don't know Type Families, but take the point that the input can be parameterised with something something other than a list. i.e. (8 :+: 4 :+: 2 :+: ()) presumably has the same type as (4 :+: 2 :+: ()).
In fact, no. (4 :+: 2 :+: ()) :: Bunch (Bunch ()) (8 :+: 4 :+: 2 :+: ()) :: Bunch (Bunch (Bunch ())) Maybe you didn't understand something? Perhaps you should try reading the HaskellWiki[1] page on type families. [1] http://www.haskell.org/haskellwiki/GHC/Type_families HTH, -- Felipe.
participants (2)
-
Felipe Lessa
-
Paul Keir