Yes, it conflicts with list.
I think the main problem is that IEnumerable is an interface and
inheritance don't play well with Typeclasses.
Here's an example:
let f g x = g <*> x <*> [4;5]
Currently works and it guess the type as:
val f : ('a -> int -> 'b) list -> 'a list -> 'b list
but if we include seq we'll get
stdin(8,15): error FS0332: Could not resolve the ambiguity inherent in
the use of the operator '( ?<- )' at or near this program point.
Consider using type annotations to resolve the ambiguity.
> let f g x = g <*> x <*> [4;5] ;;
let f g x = g <*> x <*> [4;5] ;;
Because x could be a list or a seq, then the compiler is not able to
decide which implementation should take.
One thing we can do is (again) wrap seq into a concrete type, as we
did with ZipList, then we can define Functors and monads without
conflicts.
On Dec 23, 3:39 am, Mauricio Scheffer <
mauricioschef...@gmail.com>
wrote:
> Looks very good! I'm going to try and use this in my code.
> Something odd I noticed is there seemed to be an issue with seqhttps://
github.com/gmpl/fsharpx/commit/6b29d7384e8ff72abd4e0cf9e68edb...
> Does
> it conflict with lists or something?
>
> --
> Mauricio
>
> On Thu, Dec 22, 2011 at 8:19 AM, Gustavo Leon
> <
gustavo.perezl...@gmail.com>wrote:
>
>
>
> > Hi all
>
> > I just finished implementing Typeclasses in Fsharpx in a generic way.
> > Have a look at the fork athttps://
github.com/gmpl/fsharpx
>
> > Breaking changes
> > ----------------
>
> > - Monads defined on top of primitive types (Validation, Reader,
> > Writer, State, Cont and Distribution) are wrapped now as the standard
> > Haskell version.
>
> > - Cont changed to the standard version, without the additional
> > continuation for exceptions.
>
> > - Monadic functions and operators were removed from each Monad
> > definition.
> > Now they are defined once in Prelude, as generic functions, they work
> > on every monad. There's also a generic builder for monads : do'.- Hide quoted text -
>
> - Show quoted text -