-
Notifications
You must be signed in to change notification settings - Fork 10
Week10/task3 4 #152
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
cht8687
wants to merge
41
commits into
fp-works:master
Choose a base branch
from
cht8687:week10/task3-4
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Week10/task3 4 #152
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
1340085
[Homework01-Task4]:validate
cht8687 46b7705
merge
cht8687 683385a
Week2-Task1
cht8687 1663cb8
update
cht8687 2b4e59b
ViewPattern
cht8687 64eca0f
Merge remote-tracking branch 'upstream/master'
cht8687 38160c5
update readme
cht8687 1bd8a29
merge
cht8687 53720c1
task 1
cht8687 82f8c7a
Merge remote-tracking branch 'upstream/master'
cht8687 5a964e2
Task2
cht8687 d272163
merge
cht8687 2c5b76f
change names
cht8687 272c2f1
Merge remote-tracking branch 'upstream/master'
cht8687 b5c8116
[Week4]:Task1]
cht8687 a4b4b99
Task1-2nd solution
cht8687 ecb3165
update
cht8687 e6d24c3
[week4]Task3-1
cht8687 850701e
Merge remote-tracking branch 'upstream/master'
cht8687 696a0f8
Merge remote-tracking branch 'upstream/master'
cht8687 425a656
[Week5]T1,T2,T3,T4
cht8687 1181229
Merge remote-tracking branch 'upstream/master'
cht8687 e29d702
Week6-1,2,3,4
cht8687 26e6843
week6:task5
cht8687 08428e0
merge
cht8687 c681281
(week7):Task[1..2]
cht8687 ecbb6b4
Merge remote-tracking branch 'upstream/master'
cht8687 343c8fb
[week7]:Task2.2
cht8687 f47ed90
merge upstream
cht8687 0f0badb
(week7): Task2-3
cht8687 b16680d
merge
cht8687 0677ec9
refactored to shorter
cht8687 93d8835
WIP
cht8687 795bfe9
merge
cht8687 5ee541d
[Week10]: Task 1 -> Functor
cht8687 6628f9d
(week7)-task3
cht8687 7db4986
[week10]:Task2
cht8687 f2da9ba
remove duplicates
cht8687 09bfd21
Merge remote-tracking branch 'upstream/master'
cht8687 18ca0d4
Merge remote-tracking branch 'upstream/master'
cht8687 2620b11
(week10):task3-4
cht8687 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,3 +105,22 @@ instance Applicative Parser where | |
| case f s of | ||
| Nothing -> Nothing | ||
| Just (r, s') -> fmap (first r) . g $ s' | ||
|
|
||
| -- Ex. 3 | ||
| abParser :: Parser (Char, Char) | ||
| abParser = (,) <$> char 'a' <*> char 'b' | ||
|
|
||
| abParser_ :: Parser () | ||
| abParser_ = (\a b -> ()) <$> char 'a' <*> char 'b' | ||
|
|
||
| intPair :: Parser [Integer] | ||
| intPair = (\x _ y -> [x, y]) <$> posInt <*> char ' ' <*> posInt | ||
|
|
||
| -- Ex. 4 | ||
| instance Alternative Parser where | ||
| empty = Parser $ const Nothing | ||
| (Parser g) <|> (Parser f) = Parser $ \s -> (g s <|> f s) | ||
|
|
||
| intOrUppercase :: Parser () | ||
| intOrUppercase = | ||
| ((\x -> ()) <$> posInt) <|> ((\x -> ()) <$> satisfy (isUpper)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here could also apply |
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Here as @stevemao suggested before, can use
void. Also can just reuseabParser.