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

Clean up Singletons module #31

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mrkgnao
Copy link

@mrkgnao mrkgnao commented Jun 18, 2017

This commit cleans up the horrible TH code in Tisch.Internal.Singletons somewhat.

{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, the reason why I don't align these things vertically is because of what we are seeing here: When one line changes and this change shortens or widens the largest language extension name, then one needs to change all of the lines so that #-} aligns vertically again. The same goes for imports and as, except in imports it's even worse because one also needs to worry about how to format things when the import takes more than one line, something that looks very ugly when things are vertically aligned.

It's a small detail, but it makes maintaining and reviewing code a much pleasurable experience.

Copy link
Author

@mrkgnao mrkgnao Jun 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, this was from stylish-haskell running automatically on save. I understand the diff problems that aligning code brings. :)

infixr 3 :&&&

instance SuppressUnusedWarnings (:&&&$) where
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need these SuppressUnusedWarnings things. Can we remove them or do we get some warning? Also, I think you can delete all of the constructors named *KindInference, I don't think we need those.

Copy link
Author

@mrkgnao mrkgnao Jun 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing them triggers -Wunused-top-binds warnings, which can be disabled module-locally if you'd prefer that. I'll look at the KindInference constructors.

Copy link
Owner

@k0001 k0001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! I added some minor comments that would be nice to address, but otherwise this looks way better than what we had 😄

@mrkgnao
Copy link
Author

mrkgnao commented Jun 18, 2017

@k0001 it seems I'll be able to cut this module down a lot more.

@k0001
Copy link
Owner

k0001 commented Jun 18, 2017

There's something wrong:


src/lib/Tisch/Internal/Table.hs:713:6: error:
    • Couldn't match type ‘Apply
                             (Column_NameSym0 :&&&$$$ Column_PropsSym0) ('Column n w r p h)’
                     with ‘'(n, Column_Props ('Column n w r p h))’
      Expected type: Record
                       (List.Map
                          (Column_NameSym0 :&&&$$$ Column_PropsSym0)
                          ('Column n w r p h : cols))
        Actual type: Record
                       ('(n, Column_Props ('Column n w r p h))
                          : List.Map (Column_NameSym0 :&&&$$$ Column_PropsSym0) cols)
    • In the expression:
        RCons
          (Tagged @n (colProps (Proxy @(Column n w r p h))))
          (rDistributeColProps (Proxy @cols))
      In an equation for ‘rDistributeColProps’:
          rDistributeColProps (_ :: Proxy (Column n w r p h : cols))
            = RCons
                (Tagged @n (colProps (Proxy @(Column n w r p h))))
                (rDistributeColProps (Proxy @cols))
      In the instance declaration for
        ‘RDistributeColProps ('Column n w r p h : cols)’
    • Relevant bindings include
        rDistributeColProps :: Proxy ('Column n w r p h : cols)
                               -> Record
                                    (List.Map
                                       (Column_NameSym0 :&&&$$$ Column_PropsSym0)
                                       ('Column n w r p h : cols))
          (bound at src/lib/Tisch/Internal/Table.hs:712:3)

@mrkgnao
Copy link
Author

mrkgnao commented Jun 18, 2017

It seems stack test --file-watch isn't foolproof. Sorry for the noise, I'll try to make a proper commit in some time.

@mrkgnao
Copy link
Author

mrkgnao commented Jun 19, 2017

@k0001 everything should work now.

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

Successfully merging this pull request may close these issues.

2 participants