Skip to content
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

RULES #17

Open
jkarni opened this issue Aug 25, 2016 · 0 comments
Open

RULES #17

jkarni opened this issue Aug 25, 2016 · 0 comments

Comments

@jkarni
Copy link
Contributor

jkarni commented Aug 25, 2016

Adding RULES would be great, but GHC isn't happy. E.g.:

  {-# RULES  "set/set" forall a b field book. set field a (set field b book) = set field a book
  #-}

/home/jkarni/Documents/progs/bookkeeper/src/Bookkeeper.hs:49:68: error:
    • Couldn't match type ‘Data.Type.Map.Nub
                             ((Data.Type.Set.Sort
                                 (Data.Type.Set.Filter
                                    'Data.Type.Set.FMin
                                    (field 'Data.Type.Map.:-> val1)
                                    (Data.Type.Map.Nub
                                       (Data.Type.Set.Sort (old Data.Type.Map.:\ field))))
                               Data.Type.Set.:++ '[field 'Data.Type.Map.:-> val1])
                              Data.Type.Set.:++ Data.Type.Set.Sort
                                                  (Data.Type.Set.Filter
                                                     'Data.Type.Set.FMax
                                                     (field 'Data.Type.Map.:-> val1)
                                                     (Data.Type.Map.Nub
                                                        (Data.Type.Set.Sort
                                                           (old Data.Type.Map.:\ field)))))’
                     with ‘Data.Type.Map.Nub
                             ((Data.Type.Set.Sort
                                 (Data.Type.Set.Filter
                                    'Data.Type.Set.FMin
                                    (field 'Data.Type.Map.:-> val1)
                                    (Data.Type.Map.Nub
                                       (Data.Type.Set.Sort
                                          (Data.Type.Map.Nub
                                             ((Data.Type.Set.Sort
                                                 (Data.Type.Set.Filter
                                                    'Data.Type.Set.FMin
                                                    (field 'Data.Type.Map.:-> val)
                                                    (Data.Type.Map.Nub
                                                       (Data.Type.Set.Sort
                                                          (old Data.Type.Map.:\ field))))
                                               Data.Type.Set.:++ '[field 'Data.Type.Map.:-> val])
                                              Data.Type.Set.:++ Data.Type.Set.Sort
                                                                  (Data.Type.Set.Filter
                                                                     'Data.Type.Set.FMax
                                                                     (field 'Data.Type.Map.:-> val)
                                                                     (Data.Type.Map.Nub
                                                                        (Data.Type.Set.Sort
                                                                           (old
                                                                            Data.Type.Map.:\ field)))))
                                           Data.Type.Map.:\ field))))
                               Data.Type.Set.:++ '[field 'Data.Type.Map.:-> val1])
                              Data.Type.Set.:++ Data.Type.Set.Sort
                                                  (Data.Type.Set.Filter
                                                     'Data.Type.Set.FMax
                                                     (field 'Data.Type.Map.:-> val1)
                                                     (Data.Type.Map.Nub
                                                        (Data.Type.Set.Sort
                                                           (Data.Type.Map.Nub
                                                              ((Data.Type.Set.Sort
                                                                  (Data.Type.Set.Filter
                                                                     'Data.Type.Set.FMin
                                                                     (field 'Data.Type.Map.:-> val)
                                                                     (Data.Type.Map.Nub
                                                                        (Data.Type.Set.Sort
                                                                           (old
                                                                            Data.Type.Map.:\ field))))
                                                                Data.Type.Set.:++ '[field
                                                                                    'Data.Type.Map.:-> val])
                                                               Data.Type.Set.:++ Data.Type.Set.Sort
                                                                                   (Data.Type.Set.Filter
                                                                                      'Data.Type.Set.FMax
                                                                                      (field
                                                                                       'Data.Type.Map.:-> val)
                                                                                      (Data.Type.Map.Nub
                                                                                         (Data.Type.Set.Sort
                                                                                            (old
                                                                                             Data.Type.Map.:\ field)))))
                                                            Data.Type.Map.:\ field)))))’
        arising from a use of ‘set’
      NB: ‘Data.Type.Map.Nub’ is a type function, and may not be injective
    • In the expression: set field a book
      When checking the transformation rule "set/set"
    • Relevant bindings include
        a :: val1 (bound at src/Bookkeeper.hs:49:19)
        b :: val (bound at src/Bookkeeper.hs:49:21)
        field :: Key field (bound at src/Bookkeeper.hs:49:23)
        book :: Book' old (bound at src/Bookkeeper.hs:49:29)
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