-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
Updating the Nucleotide Count exercise to return Either #165
Conversation
Either
. The resulting exercise is more idiomatic to Haskell. The Either
will provide a useful error message to end users of the functions.Either
Either
@rbasso I borrowed your implementation for the example implementation. However, it requires the |
nucleotideCounts xs = fromDistinctAscList <$> mapM count' "ACGT" | ||
where | ||
count' x = (\c -> (x, c)) <$> occur' x | ||
occur' x = occur x . fromList <$> mapM valid xs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of <$>
will probably fail if base < 4.8
, because it was only in Control.Applicative
before that.
It's a little tricky to use it in a compatible way, because if you import Control.Applicative ((<$>))
it would raise a warning (#122) on newer versions, and we intentionally fail all tests with warnings on Travis-CI.
Thanks for making this pull request, @samjonester. 😄 Right now we don't have too much flexibility about the packages we can use.
We expect to simplify this situation in the future with #162 , but now this is what we have. Also, considering that it's not easy for beginners using cabal to deal with new dependencies, I would avoid adding new packages for now unless they are really needed. Recently, I updated the |
ddb3fa4
to
e83dfd0
Compare
By using an `Either` instead of throwing an error, the resulting exercise is more idiomatic to Haskell. The `Either` will provide a useful error message to end users of the functions. Closes exercism#157
e83dfd0
to
8d20130
Compare
I've subverted the problem with prelude with Also, I've removed the dependency on @rbasso I was unable to get
|
Thanks, @samjonester ! About the If you have the time, could you open an issue with further details? I would like to fix it, as it is the only practical way we have to test problems locally with restricted dependencies. It would be good to know:
I guess the problem is the lack of GNU's This link may be useful if you are running OS X: If you're running Linux and got this error, I probably did something really wrong. 😀 |
The resulting exercise is more idiomatic to Haskell. The
Either
will provide a useful error message to end users of the functions.Closes #157