Why are duplicate imports allowed in the first place?
On Friday, August 19, 2016 at 2:20:50 AM UTC-5, Martin Janiczek wrote:
>
> Hello,
>
> I've been stumped by a compiler error which I can't figure out. I think
> it's a compiler bug. (I'd like to maybe help fix that and contribute a PR -
> even though it might get incorporated into elm-compiler waaaay later or not
> at all, I could have my own elm-compiler and continue on the project :) )
>
> import Fuzz exposing (Fuzzer)
> import Random.Pcg as Random
> import Random.Extra as Random
> import Shrink
>
>
> type alias Op op =
> { generator : Random.Generator op }
>
>
> opsFuzzer : List (Op op) -> Fuzzer (List op)
> opsFuzzer ops =
> Fuzz.custom
> (Random.together (List.map .generator ops))
> (Shrink.list Shrink.noShrink)
>
>
> -- TYPE MISMATCH ----------------------------------------------------- src
> /A.elm
>
> The type annotation for `opsFuzzer` does not match its definition.
>
> 21| opsFuzzer : List (Op op) -> Fuzzer (List op)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> The type annotation is saying:
>
> List { generator : Random.Generator b } -> Fuzzer (List b)
>
> But I am inferring that the definition has this type:
>
> List { generator : Random.Generator a } -> Fuzzer (List b)
>
> -- TYPE MISMATCH ----------------------------------------------------- src
> /A.elm
>
> The 1st argument to function `custom` is causing a mismatch.
>
> 23| Fuzz.custom
> 24|> (Random.together (List.map .generator ops))
> 25| (Shrink.list Shrink.noShrink)
>
> Function `custom` is expecting the 1st argument to be:
>
> Random.Generator a
>
> But it is:
>
> Random.Generator (List a)
>
> Detected errors in 1 module.
>
> (The larger codebase is here:
> https://github.com/Janiczek/elm-test/commit/9b8323d4721cea0f0420c1440d31b79989b7528a
> )
>
> The compiler is telling me my types don't match but I think they do (even
> by substituting the types by hand).
> Does anybody have any idea on what to do with this?
>
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.