/mlg/ Meta Languages General

Welcome to Meta Languages General

Here, nobody really cares about your arguments why your C-Family language is better.

Discuss Haskell, Purescript, ReasojnML/Ocaml, Idris, Coq, Agda etc.

> Where to learn me a Haskell?
learnyouahaskell.com/

> Where to learn PureScript
leanpub.com/purescript/read

> Monads
stackoverflow.com/questions/11234632/monads-with-join-instead-of-bind

>previous thread

Attached: haskelllogo.jpg (750x1000, 142K)

Other urls found in this thread:

www21.in.tum.de/~nipkow/pubs/aplas11.pdf
citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.72.9509&rep=rep1&type=pdf
github.com/janestreet/incr_dom
twitter.com/SFWRedditImages

lisp

I'm up to Applicative in Haskell From First Principles.

Love the language and ideas behind it, high-level stuff is the future.

so glad they teach applicative now. it's great as a stepping stone to grokking monad

name one way lisp is superior to haskell. I can't stand all the bracket clutter

Stop forcing this and shitting up this board further.

Learn what a general is and delete your garbage thread.

Fuck off with your pointless generals.

Attached: 1561299316554.jpg (548x548, 64K)

Haskell is love, every other language seems primitive in comparison

Doesnt C++ have metaprogramming?

What are you talking about? Everybody knows that forced generals that get posted despite the poster not having a specific topic in mind, that eventually (or immediately) degenerate into repeating the same low quality shitposts over and over and blogposting, are the future. I love generals! I hope that one day all of Jow Forums follows the path of high quality boards like /mu/ and Jow Forums.

>high quality boards like /mu/ and Jow Forums

user, he was obviously being sarcastic.

learn you a Haskell is awesome !!
Thanks user

the homoiconicity/bracket clutter is the best part about lisps. I still prefer haskell too though.

the bracket clutter makes it nice to write a compiler for, but shit to write code in.

Haskell & related are so much more ergonomic

For anyone actually writing haskell - have you given the GHCID workflow a spin?

it's incredible for hole-driven development, and about 10 times faster feedback loop than compilation.

in short, GHCID runs your code in interpreted mode and spits out compiler messages if there are any. it autoruns when you save a file, so you can really easily see type errors and typed hole messages.

it also has a new feature behind the --allow-eval flag where you can start a comment with `-- $> ` and pass what follows into GHCI - so you can directly ask for the types & kinds, or use :info to see what instances something has

I'm trying to learn Haskell from an OCaml background. Still confused about how hard to read Haskell is, with pointfree style, operators and typeclasses everywhere.

I've been trying several times but can't become productive enough with it to continue using it. I didn't have this problem with Clojure, even though I stopped because dynamic shit.

I feel like Haskell has potential and I would really like to understand it at a higher level, but past Functor and Monad it becomes harder (still can't understand Applicative's uses very well). Any advice ?

Question 2 : is the choice between Coq and Agda only related to your background with OCaml and Haskell, or are there other significant differences ?

How to read Pointfree:

1) for simple pointfree, you can just add an argument, so

myFunction = func1 . func2

becomes

myFunction a = func1 . func2 $ a

2) there are pointfree patterns that can make it a bit trickier, one common pattern is to see compositions where you partially apply the compose operator and see something like:

myFunction = (someFunc .) . otherfunc

essentially this is a way to pass extra arguments into a composition chain. check out the video 'pointfree or die, tacit programming in haskell' on youtube.

there's also a tool on pointfree.io where you can see any pointful statement as a pointfree statement

but quite often, it's not necessary to write things pointfree, it's just an exercise.


when it comes to coq v. agda, I'm told that coq has a better story when it comes to use in production. - personally I think it's more about Idris vs coq.

I tried haskell-ide-engine right after watching nmitchell's talk. Then I gave a quick try to ghcide and many features supported by coc.nvim failed in ghcide, so I went back to haskell-ide-engine. Might give it another try as development advances (it's still too new)

Applicative is a functor but you can map over two functors rather than one with lifta2, the result being the effects of the two functors are sequenced.

basically this, it let's you thread a functor of functions with a functor, for example this code
(,) many digit many char
[\code]
combines a multiple digit parser with a multiple character parser ( is a synonym for fmap)

GHCID isn't really meant for editor integration, you just run it side by side with your editor

Applicative is a bit funky because it primarily solves 2 problems that don't exist outside of haskell/hardcore FP

1. I need to map a curried function over two items inside of functors, but the function gets stuck inside of a functor and It's annoying to get it back out to map over the next thing.

or

2. I need to do something monad-like with my context, but what I need to do would break the monad laws. (applicative can implicate sequential dependant execution while breaking the requirement of identity on monads. See the Validation functor - it keeps a list of all the errors instead of returning the first one like an Either)

I prefer "A Gentle Introduction to Haskell" though.

Subjective opinion. I think parens are quite nice.

literally just use a threading macro and you've eliminated 90% of paren hell situations

Emacs

Somewhat brainlet having a hard time wrapping head around advanced C.

Haskell sounds interesting, am I too retard?

If not, what's a nice resource for semi-retards to learn Haskell?

No, there is absolutely no sarcasm in this board, he was being deadly serious.

Lisp macros are a superior way of metaprogramming than Template Haskell. I prefer Haskell in general tho.

Not having anything specific in my head (you will find good guides), just one tip: dont waste to much time on books and tutorials. Do some minimal amount of reading, but then do some small project yourself and learn the concepts you need as they come up (how to do IO, how to generate random numbers, how to work with arrays, ...)

>Do some minimal amount of reading, but then do some small project yourself
This is a programming thread, not a coding thread.

Why do only functional languages use hindley milner? Why aren't there any mainstream imperative languages that use it?

Um
>currying and whatnot

Which language do I start with?

COBOL.

The type system requirements for hindly milner does depend on there being no mutation and referential transparency. Language features like this/self break referential transparency.

Why did it take so long for Haskell's Applicative to get introduced? I feel like that should've been obvious from the start (Then again, I have a lisp background).

Because hindley milner is a lambda calculus?
Also like says mutation introduces inconsistency, see the ocaml value restriction.

What the fuck is a "meta language"?

I believe the term is "point free."

What languages do you already know?
What are your goals?

How 'bout muh F#?

Attached: goatparty.jpg (180x180, 20K)

Oh sorry I thought you meant ghcide, by the same author.

>/mlg/

Languages that descent from SML (Standard Meta Language). Namely the languages listed in OP.

BAhahahaha

The paper on applicative is quite recent. In short, nobody thought it was useful. Then it took a long time to have the language changed such that applicative was a prerequisite to monad.

This is why monad has 'return'. Which does the exact same thing as "pure' on applicative.

Purescript doesn't have this issue

I already love a non-employable language (Lisp), I would prefer to learn more job-oriented things now.

There are honestly not that many applicatives that aren't monads. Hell, the only ones I know of are `Validation`, `ZipList`, free applicatives, and some variants of `Lan`.

People got by using monads, and haven't seen the need for `Applicative` until recently. Also, keep in mind that the Haskell ecosystem was very stagnant until Haskell 2010, at which point it took up serious steam.

Oh, and `Const`.

I'm an imperative programmer by trade (slew of C-style syntax languages), and ever since i started learning racket ive begun to annoy my colleagues by writing superior, more maintainable code eg using declarative transformations & immutability, localizing state as a priority. I'm interested in haskell but i fear being being hand-tied and unable to practice newly learned wisdoms.
I also am finding it harder to mentally track complex interactions involving a lot of state, eg unwieldy for loops. I suspect its because there is a voice in my head saying "this is stupid, why isn't this a few maps and a reduce instead of this half-screen monstrosity" - so i mentally check out due to the emotional "fuck it not my mess".

So you kind of agree with me then? It feels bad learning all these things to never be able to put them in practice, at your workplace.

Yeah, i agree, somewhat. I still want to learn haskell/ML since ive had a lot of joy from racket, and it has made me a better programmer anyway, but hasn't really increased my job satisfaction or remuneration at all. I guess as a side effect i have a deeper understanding of SQL, which does help job wise.

>ive begun to annoy my colleagues by writing superior, more maintainable code
why the fuck would you be paid to work in a language your coworkers aren't using

I know
C, Javascript, PHP, Python, Ruby, etc.

To understand functional programming and programming in general.

Just want to know which language I should start with if I want to get into functional.

(Have a book on HOPE tho I haven't read it)

>I also am finding it harder to mentally track complex interactions involving a lot of state, eg unwieldy for loops. I suspect its because there is a voice in my head saying "this is stupid, why isn't this a few maps and a reduce instead of this half-screen monstrosity" - so i mentally check out due to the emotional "fuck it not my mess".
I'm picturing you as this guy right now

Attached: audiophile.webm (640x360, 2.55M)

Read SICP.

SQL, really? I thought data bases and lambda calculus, et al didn't have much in common

I dont know lambda calculus (only done a few small projects in racket) however coming back to SQL from racket has increased my appreciation for declarative set-based logic, eg made it easier for me to mentally break down an sqlish problem into a series of obvious data transformations and aggregations. I'm also finding it easier to read sql and other non-c style syntaxes and pick them up, as if getting use to s-exprs expanded a bit of my brain that was stuck always trying to put syntax in terms of C-style constructs. Maybe that's a handicap just because i'm strange, dunno if others experience it.

You misunderstand, i'm writing the same languages as them, but with a slightly modified style. And no, im not breaking coding convention or time-wide policies. I realize consistency is important.

kek

Haskell suffers a lot from legacy bloat.

I'd say start with haskell, or you can learn FP in javascript then move to haskell

ghcide/hie-core is dependant on ghc versions, which makes setup a pain.

ghcid is perfect for my workflow.

I'd say SQL is declarative, just like FP languages, but one relies on relational algebra, and the other on lambda calculus.

though they might have an isomorphism, unsure.

agree, purescript really frees up a lot of legacy bloat from haskell's typesystem and makes a lot of smart choices about typeclasses being granular and building on each other, it's a good 'sequel' to haskell.

I'm not actually familiar with purescript, what do you mean about "typeclasses being granular?"

so rather than one big Num typeclass that implements arithmetic operators, you have smaller typeclasses for semiring -> ring -> euclideanRing, etc.

ie typeclass dependancies that are actually informed by category theory,

it also solves a bunch of the issues with JS and is a pleasure to work with, while still allowing for JS interop, it also has backends for C and kotlin

>just add an argument
Why did you add an operator, too?

(a . b) c = a (b c)

f . g
\x -> (f . g) x -- eta expand
\x -> f (g x) -- definition of (.)

(f .) . g
\x -> ((f .) . g) x -- eta
\x -> (f .) (g x) -- (.)
\x -> f . g x -- operator section
\x -> \y -> (f . g x) y -- eta
\x -> \y -> f (g x y) -- (.)

Mainstream languages fell for the subtyping meme, which is incompatible with Hindley-Milner.

Subtying is absolutely retarded tbqh, I have no idea why it's so popular. Existentials can do everything subtypes do.

Ah, that does make sense. ZipList is the main Applicative I thought of anyway. That makes sense though. Gonna check out those other Applicatives today.

Check out `FunList`/`Bazaar` in particular. It's a particular free applicative functor, and has an extremely interesting relationship to `Traversable`.

Free applicatives in general seem to be the most useful. My favorite use of them is the free applicative of Async from Control.Concurrent.Async. It being a free applicative means that you can combine multiple Asyncs together, and then wait on all of them. Being a free applicative also means that you can get analyze them by turning each Async a into a monoidal value, like [ThreadId] or IO (), meaning you can get info about what threads are involved, or cancel all of them.

awaitAll :: Ap Async a -> IO a
awaitAll = runAp wait

cancelAll :: Ap Async a -> IO ()
cancelAll = runAp_ cancel

asyncThreadIds :: Ap Async a -> [ThreadId]
asyncThreadIds = runAp_ (\a -> [asyncThreadId a])

>Not having anything specific in my head (you will find good guides), just one tip: dont waste to much time on books and tutorials. Do some minimal amount of reading, but then do some small project yourself and learn the concepts you need as they come up (how to do IO, how to generate random numbers, how to work with arrays, ...)
This is actually good sound advice. Still need a decent beginners book recommendation though.

learn you a haskell for great good if you're a cheapskate,

learn haskell from first princeples if you actually are prepared to pay money and learn the language.

>learn you a haskell for great good
Is it some sekrit insiders joke that the title of that book is so retarded?

yeah

LYAH is shit. Just tell people to pirate HPFFP. The author is an asshole anyway, so no need to lose sleep over it or anything.

got halfway through LYAH when i was like 16. it was cool i guess. later i went to colleg. then i flunked out. now im in this thresd

Is there a programming language like Haskell where you can just straight up use existential quantifiers without having to masquerade them as universal quantification in data constructors?

How does it feel to be a failure? I've never been one, so I'd like to know.

feels free nerd

Attached: 572r32s88ns94583o796oq18pq7rn9r8.jpg (640x727, 108K)

Of course it's free, how else could you afford it?

ms pet to test functional stuff for c#. it's basically dead now even though some people are really into it

even if everything is value restricted that still a lot nice then C++'s auto and all of it's other clones.
There exist some papers of how hindley milner can be extended to subtyping, but i haven't read them yet so I can't tell which limitation they have or how viable they are.
www21.in.tum.de/~nipkow/pubs/aplas11.pdf
citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.72.9509&rep=rep1&type=pdf

I find writing Common Lisp in Emacs with paredit and aggressive-indent to be so ergonomic that I've yet to be able to get into Haskell, despite really wanting to use a Hindley-Milner language. I find using whitespace sensitive languages so much less pleasant. What is your editing setup like?

fp
bp
cringe, how are parenthesis bad?
It deletes all redundancy.
Haskell on the other hand is cringe unreadable garbage

>insider
Isn't it in the tradition of _why's (Poignant) Guide?

Is Haskell a good language to get into functional or should I try other languages like Coq or Lisp?

/thread

Yeah, Haskell's the best way to start with proper FP. Lisp and its variants like Scheme are more multiparadigm, using procedural and (non-shit) OO programming paradigms where it happens to be useful. Haskell is a deep dive into FP everywhere.

>lisp
Ahhh lisp!
The first language I learned was clojure using lighttable. I love REPL's!
Then I took the lisp nested syntax to javascript and I was able to think in computational space forever more.
(fn x (fn x y))
it just naturally made sense to me where the C style syntax did not.

Attached: 1567757069120.png (754x606, 363K)

Haskell is the C++ of FP.
Plus going back to a non dep-type system sucks.
And please don’t bring up liquid abomination.

Other FPLs like Idris improve over Haskell immensely but they don't have the resources, scope and community that Haskell does.

Yeah and they never will because lazy people like you are keeping software shit because of sunk cost.

Haskell is so fucking good bros, I love how everything comes together

doesn't change the fact that it's the best option for the uninitiated

haskell is full of legacy hacks

Definitely doesn't feel that way, but I'm curious. What isn't?

Nothing that has been around for longer than 2 months isn't.
But just off the top of my head
>non-total functions were a mistake
>undefined was a mistake
>exceptions were a mistake
>the typeclass hierarchy and many associated functions are kind of a mess with shit like applicative messily wedged in post hoc
>type system extensions are messy and inelegant

> meta language general
> no LISP

alright boys. wrap it up. we've got a massive brainlet on our hands.

Attached: doofus.jpg (302x167, 6K)

Lisp is not a derivative of ML.

>>non-total functions were a mistake
sure, but that's in issue with Prelude and not Haskell
>>undefined was a mistake
Completely disagree on that one. It's an amazing tool for designing your program and making sure your types align before writing all of the logic.
>>exceptions were a mistake
see my stance on non-total functions
>>the typeclass hierarchy and many associated functions are kind of a mess with shit like applicative messily wedged in post hoc
I kind of agree on this one. The pure/return thing is annoying.
>>type system extensions are messy and inelegant
can't comment on this because I haven't messed with them enough

Javascripts lodash or underscore

> Where to learn PureScript
Why would you learn PureScript when you can just use incr_dom?
github.com/janestreet/incr_dom

How does programming in haskell 2nd edition compare to learn you a haskell? They're pushing that book but I prefer pirating/free shit.

It's only pointless if Lisp isn't welcome here

Attached: 1568330913178.jpg (321x217, 22K)