Giter VIP home page Giter VIP logo

haskell-for-readers's Introduction

Haskell for Readers

This is the source repository for the “Haskell for Readers” Haskell lecture. If you want to read the lecture notes, you very likely want to go to http://haskell-for-readers.nomeata.de/, where you will also find PDF-versions of the notes.

Contributions to the text, e.g. fixing typos or such, are welcome. Just edit haskell-for-readers.md and create a pull request.

haskell-for-readers's People

Contributors

agam avatar arpl-c-63h avatar eschnett avatar ghuntley avatar josephcsible avatar nomeata avatar rolfschr avatar yarikoptic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haskell-for-readers's Issues

Readme?

Hi, this project looks really cool! Would it be possible for you to add a readme with set up instructions and example usage? Thanks.

Typos and stuff

First time ever I've done anything like this so don't know the protocol. Also non-native English speaker.

  • "This document is work in progress" -> a (?) work in progress
  • "will gain useful insight from tutorial" -> from this tutorial
  • "The exercises are not sufficient in number and depths" -> depth
  • "to provide the reader the experience needed" -> with the experience
  • "are marked with ★" -> with a (?)
  • "Functional program" -> programming
  • "Both operator are left-associative" -> operators
  • "which is again shorter than" -> smaller than
  • "no parenthesis or commas needed" -> parentheses
  • "and less noise code" -> noisy
  • "If you leave out the parenthesis, you get a horrible error messages" -> If you leave out the parentheses, you can get horrible error messages ... but if you leave out a parenthesis, you can get a horrible error message ... or can get horrible error messages. [So this is about plurals, their spelling and the correct articles associated with them.]
  • "the same as parenthesis around the rest of the line" -> parentheses
  • "because the dollar operator it is not part of the built-in language" -> delete it
  • "but can be define by anyone" -> defined
  • "isHalfRound x = x div 10 == 0 || x div 10 == 5" -> div should be mod
    --> Other occurrences: "isEven x = x div 10 == 0 || x div 10 == 2 || x div 10 == 4 || x div 10 == 6 || x div 10 == 8" "x div 10 == y" "hasLastDigit x y = x div 10 == y" "x divides y = x div y == 0"
  • Unicode Character 'FULL BLOCK' in "countDigits n = if n < 10 then 1 else █" "countDigits n = if n < 10 then 1 else (n div 10)█" "countDigits n = if n < 10 then 1 else countDigits (n div 10)█"
  • "Use this function and countDigits to write a function isMultipleOf3 so that isMultipleOf3 x is true if repeatedly applying countDigits to x results in 3 or 9."
    "isMultipleOf3 x = fixEq sumDigits x == 3 || fixEq sumDigits x == 6 || fixEq sumDigits x == 9"
    Specification: use countDigits. Implementation uses sumDigits.
  • "Instead of defining a countDigits as a function" -> delete first a
  • "deep and beautiful explanation we write multiple arguments" -> why (?) we write
  • "composition of a bunch of function" -> functions
  • "points-free" -> point-free or pointfree?

Section 2 and on later. Unless I'm going about this all wrong ... I'm sure you will let me know in that case.

Dollar can't be defined by anyone

I call this non-syntactic sugar, because the dollar operator is not part of the built-in language, but can be defined by anyone.

This isn't completely true. In particular, $ is hardcoded in GHC to support impredicativity in a way that user-defined functions can't. The best-known case of when that matters is when using it with runST. Specifically, this is valid:

runST $ do
  return 42

But this isn't:

runST `myDollar` do
  return 42

Function application

About this sentence
we can say that function application behaves like an right-associative operator of highest precedence

Shouldn’t that be left-associative?

Strange wording?

I think the phrase "With (>>=), you choose which action to do as the second argument based on the return value of the action of the first argument." is not as intended. Section 6.7

Not so intuitive solution for exercise 25 ?

In Exercise 25, the reader is expected to implement
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c) (1)
which the same as the "official" delcaration
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> (m c) (2).

The presented solution is (a >=> b) x = a x >>= b. I feel like the solution rather "fits" to (2) and (>=>) a b = (\x -> a x >>= b) (or similar) would be an "appropriate" solution of (1). I understand that this is just a matter of style. I just felt it could be made a bit more intuitive - given the target audience.

Spend more time with `data` syntax

I think the syntax for data declarations is one of the uglier parts of haskell, and one I see beginners struggle with (and something I remember finding confusing).

data Foo a b = Bar Int Char a | Foo 
     \_____/   \_/ \________/   \_/
       Type   Term    Type     Term (n.b. this `Foo` is in a totally 
                                different namespace from the type `Foo`)

The difficulties are:

  • there's a lot of punning going on, with type- and term-level stuff mixed together
  • confusing things further, type and data constructors often share the same name (and "constructor" is a kind of unsatisfying overloaded term)
  • the = is fairly meaningless (note in type syntax the = actually means =, i.e. what we have is a simple type-level function; I think it might make sense to introduce type first since the syntax is much more sensible.
  • the | are unrelated to guards but that might confuse people
  • the way the syntax relates to patterns can be confusing, e.g. Foo a b = ... looks like a pattern but isn't, likewise (Bar Int Char) isn't a valid pattern

I think the most important thing is to make totally clear which parts of the declaration correspond to things that live in type signatures and which things only live in code (maybe by highlighting an example in two different colors). Then you could show a code snippet that uses all the pieces from the declaration with the same highlighting (the type in a type signature, data constructors in both patterns and in RHS).

I don't know how much of the other stuff is necessary to mention/gripe about, but I think it can sometimes be encouraging to learners to hear that something they find confusing or weird is actually confusing/weird/bad.

sorry I don't have a proper edit to suggest right now, but I might be able to open a PR later if you are interested

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.