universeodon.com is part of the decentralized social network powered by Mastodon.
Be one with the #fediverse. Join millions of humans building, creating, and collaborating on Mastodon Social Network. Supports 1000 character posts.

Administered by:

Server stats:

3.3K
active users

Learn more

#haskell

51 posts34 participants0 posts today

GHC 9.10.2 release candidate 1 is now available for your testing. This is a big release for a minor release; far too many bug fixes to list. As always, please do open a ticket if you findanything amiss.

Happy Haskelling!

another #haskell question

f x y = g1 x y

can be reduced to

f x = g1 x

and probably again

f = g1

------------

... but what about

f x y = (g1 x y) || (g2 x y)

when I try the following I get errors

f = g1 x || g2 x

and this too get errors

f = g1 || g2

#haskell puzzle !

the following is a recursive function written fairly generically

myfun a b [] = []
myfun a b (x:xs) = myfun a2 b xs
where a2 = something

for me this hangs unless I move the definition of a2 inline as follows

myfun a b [] = []
myfun a b (x:xs) = myfun (something) b xs

what am I doing wrong? I thought it would be equivalent ...

actual code is in reply to this post

#haskell question

given a list [Either String Int]

I want to return Right (sum of all the ints) or Left "no data" if there are no Rights

my solution is not too bad but I initially wanted to use some of kind foldr with a default value of type Left which is "overwritten" by Right if there are any

is this possible?

-----

sumSuccess :: [Either String Int] -> Either String Int
sumSuccess el
| length rl == 0 = Left "no data"
| otherwise = Right (sum rl)
where rl = Data.Either.rights el

#haskell advice needed

what is going on here? the question is asking what type x must be

x (&&) y

--

my thinking

if it were `x && y` then I would say both x and y have to be of type Bool because that is what is expected by &&

but (&&) must be something else. I tried

True (&&) True

in the ghci and it complains

I only know about "sections" which are partially applied operators eg (2*) and (+1)

so it (&&) is partially applied AND then it must be equivalent to && but I know I am wrong!

When I was coding professionally, I found it frustrating when people talk about how #haskell isn't used in production.

Now I found it plain baffling. Why is "used in production" perceived as some kind of indicator for quality? As if we haven't seen the most horrendous/inefficient/wrong code and languages used in production.
#programming

Here's a thrilling odyssey of a C/C++/Rust acolyte discovering that Haskell—yes, 💀 #HASKELL 💀—can do concurrency! Who knew that "self-indulgent academic baloney" could also be "fast, simple, correct"? 🙄 Get ready for groundbreaking insights that will inevitably make you reconsider every life choice you've ever made about #concurrency. 🥱
bitbashing.io/haskell-concurre #Cplusplus #Rust #ProgrammingInsights #TechOdyssey #HackerNews #ngated

Bit BashingConcurrency in Haskell: Fast, Simple, CorrectYet another programming blog. Thoughts on software and related misadventures.