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

Add IsString instance for ShortText newtypes #4229

Merged
merged 2 commits into from
Jan 16, 2017
Merged

Conversation

phadej
Copy link
Collaborator

@phadej phadej commented Jan 12, 2017

Resolve #4224

@mention-bot
Copy link

@phadej, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dcoutts, @ezyang and @hvr to be potential reviewers.

Copy link
Member

@23Skidoo 23Skidoo left a comment

Choose a reason for hiding this comment

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

LGTM.

instance IsString ModuleName where
fromString string = fromComponents (split string)
where
split cs = case break (=='.') cs of
Copy link
Member

Choose a reason for hiding this comment

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

May be worth copying splitOn from Data.List.Split to D.S.Utils.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's do it later. This commit just moves as little code as possible

Copy link
Member

Choose a reason for hiding this comment

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

Sure.

Copy link
Collaborator Author

@phadej phadej Jan 13, 2017

Choose a reason for hiding this comment

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

Now i remember, splitOn is quite general reusing other combinators in split. Also this is less general splitOn' :: a -> [a] -> [[a]], where Data.List.Split.splitOn :: [a] -> [a] -> [[a]]

Copy link
Member

Choose a reason for hiding this comment

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

You're right, this is more like Data.List.wordsBy.

@ezyang
Copy link
Contributor

ezyang commented Jan 13, 2017

OK!

@23Skidoo
Copy link
Member

Travis failure is genuine:

Distribution/Utils/ShortText.hs:20:1: Warning:
    The import of ‘Data.String’ is redundant
      except perhaps to import instances from ‘Data.String’
    To import instances alone, use: import Data.String()
<no location info>: 
Failing due to -Werror.

@phadej
Copy link
Collaborator Author

phadej commented Jan 13, 2017

new try

@phadej
Copy link
Collaborator Author

phadej commented Jan 13, 2017

Ah. cannnot bump optparse-applicative because of haskell/hackage-security#179. Will wait for it.

@phadej phadej merged commit c82be5b into haskell:master Jan 16, 2017
@phadej phadej deleted the is-string branch January 16, 2017 05:50
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.

4 participants