Shoot, you're right! (And I thought I checked for that.) I have created my own Random.Pcg `together` and it compiles. I will at least post this to *error-message-catalog* :)
Thank you! On Friday, August 19, 2016 at 10:14:28 AM UTC+2, Nick H wrote: > > I think this error might have to do with these two lines: > > import Random.Pcg as Random > import Random.Extra as Random > > These two libraries are not designed to work together. Random.Extra works > with the Generator type that is defined in the core library. Random.Pcg > defines its own type called Generator > > So when you call Random.together, you are passing it a > Random.Pcg.Generator, but it is expecting a core Generator. > > > On Fri, Aug 19, 2016 at 12:20 AM, Martin Janiczek <[email protected] > <javascript:>> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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.
