#Haskell

Tariqrzeta0
2025-05-03

Learn You A Haskell for Great Good does one thing well I imho.

It discussed a random number generator to introduce the idea of internal state compared to output value.

When you pull a random number, the state of the generator changes, so that the next pulled value is different.

And this works really well to explain the State Monad.

(I'm still learning, and wading through terrible and good explanations)

2025-05-03

"Data.Graph.stronglyConnCompR" from "containers" distinguishes between isolated vertices and vertices with self-loops, which is the behavior I needed 👍
hackage-content.haskell.org/pa
hackage-content.haskell.org/pa

#Haskell

ghci> import Data.Graph
ghci> stronglyConnCompR [((),"foo",[])]
[AcyclicSCC ((),"foo",[])]
ghci> stronglyConnCompR [((),"foo",["foo"])]
[NECyclicSCC (((),"foo",["foo"]) :| [])]
2025-05-03

I've created a PR in #Nixkell, a simple #Nix #Haskell setup framework, to add support for easy building of statically-linked executables (github.com/pwm/nixkell/pull/50). I'd appreciate it if any Nixkell users gives it a try for their projects. I've been using this code for a couple of my projects, and it works fine for me, but I'd like to have more working examples.

#programming

2025-05-03

@nobodyinperson Glad to read that you at least have a work-around.

Though I'm a little surprised that the top level directory convention is not being followed in a project that seems to have it's roots in UNIX. In the Windows world, it was common to package the contents of a directory in a .zip file, which caused all sorts out problems. Unpack a zip in the wrong place and cleaning up could be a real chore! I wonder if this is an artifact of #Haskell build conventions?

2025-05-03

Energy prices as command prompt ASCII table -- Haskell version

#CLI #Haskell

photonsphere.org/post/2025-05-

Anupam 《ミ》λ≡aj@id1.in
2025-05-03

Is there any org in #Bangalore that would like to lend their space for an #FPIndia meetup? Please dm

#India #FunctionalProgramming #Meetup #Haskell #PureScript #Erlang #Elixir #OCaml #Scala #Clojure

2025-05-03

@fl By the way, purity is really a concrete fact about a language: #Haskell functions really CANNOT perform side effects --- they can only *return values that represent side-effects* (which are then executed by the runtime). The difference is subtle, but crucial.

Tariqrzeta0
2025-05-03

advice needed

puzzling out monads ...

---

occurrences :: (Eq a) => [a] -> State [(a,Int)] Int
occurrences [] = do
l <- get
return (length l)
occurrences (x:xs) = do
count x
occurrences XS

---

Q1a Why does `get` only get the first part of the monad, the list ?

Q1b Is this the "state", the s in `State s a` ?

Q2a Why does `return` only update the second part of the monad, the integer ?

Q2b Is this the "value", the a in `State s a` ?

2025-05-02

How to control #superintelligence ?
IIUC, the approach here is to use provable languages like #Haskell to ensure the model does only the things you want and provably cannot do Bad Things.

How to deal with the required insanely large logic proofs? OFC, use #AI for that!

I'm missing something. What exact program do you want the machine to prove? Programs that the LLM writes? Or the LLM itself? Surely the latter is computationally intractable...?

youtube.com/watch?v=oX3C58kBsZ

arxiv.org/abs/2404.09939

Tariqrzeta0
2025-05-02

my journey so far

bady drawn chart showing a "hockey stick" joint where difficult learning haskell jumps up
Anupam 《ミ》λ≡aj@id1.in
2025-05-01

If you want to learn #Haskell, and are not allergic to frontend development, start with #PureScript.

Yes, the tooling situation in Haskell is that bad, and it will actively prevent you from focusing on learning. PureScript meanwhile is basically Haskell, and fantastic and modern in every way.

You will thank me

Issue 470 :: Haskell Weekly newsletter

programming.dev/post/29548726

Beady Belle FanchannelProfpatsch@mastodon.xyz
2025-05-01

hackage.haskell.org/package/ol

GHC plugin that can fill typed holes with LLM expansion

#haskell #llm

Tariqrzeta0
2025-05-01

the following took me 3 days to get right - it passes the mooc testing

but is there a better "model solution" way than my combining an fmap inside a >>= operation ?

looks a bit clunky and non-idiomatic

---

countAndLog :: Show a => (a -> Bool) -> [a] -> Logger Int
countAndLog f [] = return 0
countAndLog f (x:xs)
| f x = Logger [show x] 1 >>= (\n -> fmap (+1) (countAndLog f xs))
| otherwise = countAndLog f xs

---

1/2

2025-05-01

And FP was created even before that

(from "Programming Haskell" by Graham Huttom)

#functionalprogramming #haskell #lisp

In the 1930s, Alonzo Church developed the lambda calculus, a simple
but powerful mathematical theory of functions.
• In the 1950s, John McCarthy developed Lisp (“LISt Processor”), gener-
ally regarded as being the first functional programming language. Lisp
had some influences from the lambda calculus, but still adopted variable
assignments as a central feature of the language.
• In the 1960s, Peter Landin developed ISWIM (“If you See What I
Mean”), the first pure functional programming language, based strongly
on the lambda calculus and having no variable assignments.
• In the 1970s, John Backus developed FP (“Functional Programming”), a
functional programming language that particularly emphasised the idea
of higher-order functions and reasoning about programs.
• Also in the 1970s, Robin Milner and others developed ML (“Meta-
Language”), the first of the modern functional programming languages,
which introduced the idea of polymorphic types and type inference.
• In the 1970s and 1980s, David Turner developed a number of lazy func-
tional programming languages, culminating in the commercially pro-
duced language Miranda (meaning “admirable”).
• In 1987, an international committee of researchers initiated the devel-
opment of Haskell (named after the logician Haskell Curry), a standard
lazy functional programming language.

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst