Skip to content

Better type errors for a relatively simple expression #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
meditans opened this issue Aug 26, 2016 · 0 comments
Open

Better type errors for a relatively simple expression #19

meditans opened this issue Aug 26, 2016 · 0 comments

Comments

@meditans
Copy link
Contributor

With reference to the issue #16, the code

c :: (Settable "pitch" Pitch old new, Default (Book' old)) => Book' new
c = set #pitch C def

which now errors with:

    • Could not deduce (Map.Submap
                          (Data.Type.Map.Nub (Data.Type.Set.Sort (old0 Map.:\ "pitch")))
                          old0,
                        (Map.Nubable
                           ((Data.Type.Set.Sort
                               (Data.Type.Set.Filter
                                  'Data.Type.Set.FMin
                                  ("pitch" ':-> Pitch)
                                  (Data.Type.Map.Nub (Data.Type.Set.Sort (old0 Map.:\ "pitch"))))
                             Data.Type.Set.:++ '["pitch" ':-> Pitch])
                            Data.Type.Set.:++ Data.Type.Set.Sort
                                                (Data.Type.Set.Filter
                                                   'Data.Type.Set.FMax
                                                   ("pitch" ':-> Pitch)
                                                   (Data.Type.Map.Nub
                                                      (Data.Type.Set.Sort (old0 Map.:\ "pitch"))))),
                         Data.Type.Map.Sortable
                           ("pitch" ':-> Pitch
                              : Data.Type.Map.Nub (Data.Type.Set.Sort (old0 Map.:\ "pitch")))),
                        new
                        ~
                        Data.Type.Map.Nub
                          ((Data.Type.Set.Sort
                              (Data.Type.Set.Filter
                                 'Data.Type.Set.FMin
                                 ("pitch" ':-> Pitch)
                                 (Data.Type.Map.Nub (Data.Type.Set.Sort (old0 Map.:\ "pitch"))))
                            Data.Type.Set.:++ '["pitch" ':-> Pitch])
                           Data.Type.Set.:++ Data.Type.Set.Sort
                                               (Data.Type.Set.Filter
                                                  'Data.Type.Set.FMax
                                                  ("pitch" ':-> Pitch)
                                                  (Data.Type.Map.Nub
                                                     (Data.Type.Set.Sort (old0 Map.:\ "pitch"))))))
      from the context: (Settable "pitch" Pitch old new,
                         Default (Book' old))
        bound by the type signature for:
                   c :: (Settable "pitch" Pitch old new, Default (Book' old)) =>
                        Book' new
        at /home/carlo/code/haskell/forks/bookkeeper/src/Bookkeeper/Internal.hs:256:6-71
      The type variable ‘old0’ is ambiguous
    • In the ambiguity check for ‘c’
      To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
      In the type signature:
        c :: (Settable "pitch" Pitch old new, Default (Book' old)) =>
             Book' new
Failed, modules loaded: Bookkeeper.Internal.Errors.

could expose a more friendly error to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant