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

Week 5 Ex 1, 2, 3, 4, 5 #67

Merged
merged 1 commit into from
Sep 9, 2019
Merged

Week 5 Ex 1, 2, 3, 4, 5 #67

merged 1 commit into from
Sep 9, 2019

Conversation

tienwei
Copy link
Contributor

@tienwei tienwei commented Sep 7, 2019

Not too sure about Ex3. Any feedback is greatly appreciated.
Thanks.

@tienwei tienwei changed the title Week 5 Ex 1, 2, 3 Week 5 Ex 1, 2, 3, 4 Sep 7, 2019
cis194/week5/tien/src/Calc.hs Outdated Show resolved Hide resolved
cis194/week5/tien/src/Calc.hs Outdated Show resolved Hide resolved
cis194/week5/tien/src/Calc.hs Outdated Show resolved Hide resolved
cis194/week5/tien/src/Calc.hs Outdated Show resolved Hide resolved
@tienwei tienwei changed the title Week 5 Ex 1, 2, 3, 4 Week 5 Ex 1, 2, 3, 4, 5 Sep 8, 2019

instance Expr Mod7 where
lit a = Mod7 $ mod a 7
add (Mod7 a) (Mod7 b) = Mod7 $ lit (a + b)
Copy link
Member

Choose a reason for hiding this comment

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

nit:
Normally, we use function composition style:

Suggested change
add (Mod7 a) (Mod7 b) = Mod7 $ lit (a + b)
add (Mod7 a) (Mod7 b) = Mod7 . lit $ (a + b)

@shineli1984
Copy link
Member

Good work!

@shineli1984 shineli1984 merged commit b355ea3 into fp-works:master Sep 9, 2019
stevemao added a commit that referenced this pull request Sep 15, 2019
* master:
  week 6 (#85)
  Week6 (#83)
  Fix warnings in week 1-5 (#84)
  Daniel M Week 5 (#81)
  Update README.md
  Week5-T1,T2,T3,T4 (#77)
  Wei Ning CIS194 Week 5 homework (#80)
  Daniel Deng Week04 - Exercise 02 ~ 04 (#79)
  Fix some nits (#78)
  Week5 Ex 1, 2, 3, 4, 5 (#67)
  Week4 (#70)
  Week 5 ex 2 to 6 (#76)
  week 5: use applicative and composition styles (#75)
cht8687 added a commit to cht8687/2019-winter-Haskell-school that referenced this pull request Sep 16, 2019
* upstream/master:
  generalize Num (Stream a) instance (fp-works#87)
  Fix Week6 nits (fp-works#86)
  week 6 (fp-works#85)
  Week6 (fp-works#83)
  Fix warnings in week 1-5 (fp-works#84)
  Daniel M Week 5 (fp-works#81)
  Update README.md
  Week5-T1,T2,T3,T4 (fp-works#77)
  Wei Ning CIS194 Week 5 homework (fp-works#80)
  Daniel Deng Week04 - Exercise 02 ~ 04 (fp-works#79)
  Fix some nits (fp-works#78)
  Week5 Ex 1, 2, 3, 4, 5 (fp-works#67)
  Week4 (fp-works#70)
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