Re: Overlapping instances in existentials

2003-06-20 Thread oleg
Ed Komp replied to Simon Peyton-Jones: > Within the GHC compiler > > can't be instantiated to Double --- but that's tricky to pin down. > this may be tricky to pin down. > But, there is specific information in my example to exclude Double: > I had carefully constructed the type definitions to avo

Re: Overlapping instances in existentials

2003-06-20 Thread Dean Herington
Dylan Thurston wrote: > On Thu, Jun 19, 2003 at 11:08:35AM -0500, Ed Komp wrote: > > > | type BaseType = Either Integer ( Either Bool () ) > > > | > > > | type Value = (Either Double BaseType) > > > | > > > | data Foo = forall x. (SubType x BaseType) => MkFoo x > > > | > > > | test :: Foo

RE: stack space overflow

2003-06-20 Thread Hal Daume
Seems to work for me. I changed it a bit (I believe you meant 'len ar' on the first line, with the following defintion of 'len': len = (1+) . uncurry (flip (-)) . bounds , but other than that, I left your code as it is). Can you provide input on which it fails? It works for me on large input l

stack space overflow

2003-06-20 Thread Ketil Z. Malde
Hi, I have a small function to find all indices in an array where a given subword can be found, looking like this: > ind i ws ar > | i+length ws-1 > len e = [] > | and [ar!(i+j) == ws!!j | j<-[0..length ws-1]] = i : ind (i+1) ws ar > | otherwise = ind (i+1) ws ar (i::Int

Re: In search of: [a->b] -> a -> [b]

2003-06-20 Thread Wolfgang Lux
Christian Sievers wrote: This is a case where I'd prefer a list comprehension: flist fs a = [ f a | f <- fs ] (and this could be a monad comprehension, if Haskell still had them...) And it still has them, you just have to get accustomed to the slightly different syntax :-) flist fs a = do f <-

Re: Overlapping instances in existentials

2003-06-20 Thread Dylan Thurston
On Thu, Jun 19, 2003 at 11:08:35AM -0500, Ed Komp wrote: > > | type BaseType = Either Integer ( Either Bool () ) > > | > > | type Value = (Either Double BaseType) > > | > > | data Foo = forall x. (SubType x BaseType) => MkFoo x > > | > > | test :: Foo -> Value > > | test (MkFoo x) = inj x

Re: In search of: [a->b] -> a -> [b]

2003-06-20 Thread Keith Wansbrough
Derek Elkins wrote: > Christian Sievers <[EMAIL PROTECTED]> wrote: > > > (and this could be a monad comprehension, if Haskell still had > > them...) > > I don't think Haskell ever had them (I'd have to check). > Gofer did. They were put in for Haskell 1.4, and removed again for Haskell 98 becaus

Re: In search of: [a->b] -> a -> [b]

2003-06-20 Thread Derek Elkins
On Thu, 19 Jun 2003 18:05:11 +0200 Christian Sievers <[EMAIL PROTECTED]> wrote: > Derek Elkins wrote: > > > > flist :: [a->b] -> a -> [b] > > > flist fs a = map (flip ($) a) fs > > or much nicer (IMO) > > flist fs a = map ($ a) fs > > This is a case where I'd prefer a list comprehe

Re: Overlapping instances in existentials

2003-06-20 Thread Ed Komp
Simon, Thanks for the extended response to my question about overlapping instances. Before my original posting, I had read a posting that included the example with Show that you included in your response. I believed (and still do) that my specific case is a bit different. | To determine (SubType

Re: In search of: [a->b] -> a -> [b]

2003-06-20 Thread Christian Sievers
Derek Elkins wrote: > > flist :: [a->b] -> a -> [b] > > flist fs a = map (flip ($) a) fs > or much nicer (IMO) > flist fs a = map ($ a) fs This is a case where I'd prefer a list comprehension: flist fs a = [ f a | f <- fs ] (and this could be a monad comprehension, if Haskell stil