Closed rachelcarmena closed 4 years ago
Thanks for listing the missing ones. I'll take a closer look, but several snippets were not converted: mostly Haskell pseudocode as well as the snippets of the exercises. I'll see if I missed some other ones.
Thanks for your answer, @hmemcpy !!
Oh, sorry :pray: I forgot the Challenges
section... :woman_facepalming:
This is the updated list without the snippets in that section:
4 src/content/1.3/categories-great-and-small.tex
4 src/content/1.7/functors.tex
3 src/content/1.8/functoriality.tex
1 src/content/3.11/kan-extensions.tex
6 src/content/2.2/limits-and-colimits.tex
1 src/content/3.8/f-algebras.tex
1 src/content/3.2/adjunctions.tex
1 src/content/3.4/monads-programmers-definition.tex
2 src/content/1.9/function-types.tex
Thanks and sorry again!
No worries, happy you did this, I will double-check the missing snippets!
Thanks @hmemcpy !!
By the way, I didn't write how I got this new list because it's a little messy (I only focused on the goal) though here it is:
$ grep -rn "Challenges" | cut -f1,2 -d: > challenges-line.txt
$ for line in `grep -rn '{snip}{haskell}' . | cut -f1,2 -d:`; do FILE=`echo $line | cut -f1 -d:`; CHALLENGES_SECTION=$(grep "/"$(basename $FILE) challenges-line.txt); if [ "$CHALLENGES_SECTION" != "" ]; then CHALLENGES_START=$(echo $CHALLENGES_SECTION | cut -f2 -d:); FOUND=$(echo $line | cut -f2 -d:); if [[ $FOUND -lt $CHALLENGES_START ]]; then echo $line; fi; else echo $line; fi; done | cut -d: -f1 | uniq -c
4 ./src/content/1.3/categories-great-and-small.tex
4 ./src/content/1.7/functors.tex
3 ./src/content/1.8/functoriality.tex
1 ./src/content/3.11/kan-extensions.tex
6 ./src/content/2.2/limits-and-colimits.tex
1 ./src/content/3.8/f-algebras.tex
1 ./src/content/3.2/adjunctions.tex
1 ./src/content/3.4/monads-programmers-definition.tex
2 ./src/content/1.9/function-types.tex
I took a closer look at the remaining snippets (thanks so much for the command line magic!). To be perfectly honest, most Scala snippets were provided by @Zelenya via the https://github.com/typelevel/CT_from_Programmers.scala project, so I wasn't directly involved in that.
Some of the missing snippets indeed seem to be either Haskell pseudocode, or specific features which don't have a direct Scala alternative.
For example, in categories-great-and-small.tex
, the 4 missing snippets explain that Haskell operators can be used in the prefix form (e.g. (++) "Hello " "world!"
), and as far as I know, Scala does not support that.
In functors.tex
the missing snippets are in Haskell pseudocode, showing preservation via equational reasoning. I suppose it wasn't worth converting that to Scala.
In functoriality.tex
it shows Haskell-specific features, in particular, deriving of Functor instances (a feature that currently does not exist in Scala without using 3rd party libraries), as well as another example of a prefix operator form
In kan-extensions.tex
the snippet seems to be pseudocode.
In limits-and-colimits.tex
it seems to be demonstrating Haskell's type inference rules. I'm not 100% sure about this one, perhaps @Zelenya could add some input here?
In f-algebras.tex
it shows composition in a way that I doubt possible in Scala. Again, no good answer here :) I suspect this can be found in Scala's recursion schemes library like Matrioshka, but I'm afraid to look!
Same thing in adjunctions.tex
.
In monads-programmers-definition.tex
shows monad laws in pseudocode.
In function-types.tex
the first snippet (which arguably could be converted) depends on the 2nd snippet which shows a use of Haskell's newtype
, which doesn't have a good direct equivalent in Scala 2.
I hope this helps!
Wow! Thanks @hmemcpy !! :clap: Super useful!! It helps for sure.
Let's see if @Zelenya wants to add something. Otherwise, we can close this issue.
Thanks again!!
I'd rather not :sweat_smile:
Alrighty then 🤣
:laughing: Thank you very much!! Closing...
Hi! I found these
Haskell
snippets without being extracted and translated inScala
:The first column is the number of
Haskell
snippets without being extracted and translated per file.Please, is it a known thing? I found it when helping with the snippets in Kotlin. Thanks in advance!