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
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
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
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
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 <-
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
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
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
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
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
10 matches
Mail list logo