Haskell

joeyh,
@joeyh@hachyderm.io avatar

wrote a #haskell #wasm program that ran in firefox and hung wayland hard (no mouse pointer movement)

ummmmm

bremner,
@bremner@mathstodon.xyz avatar

@joeyh nice sandbox you got there. It would be a shame if it completely failed to isolate.

maralorn,
@maralorn@chaos.social avatar

The talks from 2023 are online now. It was a super cool event with some amazing talks.

Especially I want to recommend the, as always, very educational talk by Alexis King about delimited continuations: https://www.youtube.com/watch?v=DRFsodbxHQo

And a completely crazy talk by Ben Lynn about building a Haskell compiler based on an old concept from logic research. Just incredible fun to watch: https://www.youtube.com/watch?v=3kMvXXGXaws

mangoiv,
@mangoiv@functional.cafe avatar

@maralorn i second this! These two talks completely killed it.

nomeata,
@nomeata@mastodon.online avatar

A Github Action to create PRs that bump the upper bounds of the dependencies in your cabal files, brought to you by :
https://github.com/nomeata/haskell-bounds-bump-action

joeyh,
@joeyh@hachyderm.io avatar
joeyh,
@joeyh@hachyderm.io avatar

@terrorjack I'm curious how much of my time you think I've wasted doing this. ;-)

I didn't even look at how Asterius does it.

terrorjack,
@terrorjack@functional.cafe avatar

@joeyh heartwarming to see experiments like this :) i wouldn't say time is wasted, though much of the glue code will indeed become obsolete once i really get an mvp of jsffi working

barubary,

Today I spent a few hours trying to track down a problem deep in a helper module of a complex production application written in . Among other things, it involves threads, a monad transformer stack (3 or 4 levels deep, I think?), an SQL database, and HTTP calls to an external service.

In the end, I managed to boil one issue in the code down to the following crucial lines:

forever_mpl :: Monad m => m a -> m b<br></br>forever_mpl m = fix (m >>)<br></br><br></br>forever_mpf :: Monad m => m a -> m b<br></br>forever_mpf m = fix (self -> m >> self)<br></br>

In theory, both of these should be equivalent to forever from the base library. However ...

In one place in the code, using forever_mpl (the first definition) works correctly: It repeats an action forever. But switching to forever_mpf (the second definition) makes the code hang instead (at 0% CPU). Why?!

I know the answer now, so here's a challenge: Can you think of a reason why these two definitions should behave differently? Can you implement a Monad instance with a >> that distinguishes between them somehow?

jaror,
jaror avatar

@barubary It could be bottom depending on the monad instance, but I get your point. Anyway here is my solution to the puzzle:

-- T.hs
{-# LANGUAGE Strict #-}
{-# OPTIONS_GHC -O0 #-}
module T where

import Control.Monad
import Data.Function

forever_mpl :: Monad m => m a -> m a
forever_mpl m = fix (m >>)

forever_mpf :: Monad m => m a -> m a
forever_mpf m = fix (\self -> m >> self)
-- Main.hs
import T
import Control.Monad

data Id a = Id a deriving Functor
instance Applicative Id where
  pure x = Id x
  (<*>) = ap
instance Monad Id where
  Id x >>= k = Id (case k x of (Id y) -> y)

main1 = case forever_mpl (Id ()) of Id{} -> putStrLn "Done"
main2 = case forever_mpf (Id ()) of Id{} -> putStrLn "Done"

Now in GHCi:

$ ghci Main.hs
ghci> main1
Done
ghci> main2
-- loops forever
jaror,
jaror avatar

Here a simplified and fixed single-file version: https://play.haskell.org/saved/586ysdOP

nmeum,
@nmeum@chaos.social avatar

The latest and greatest GHC version (9.8.2) is now available in the Alpine Linux Edge repositories and will be included in the upcoming 3.20 stable release.

koz,
@koz@chaos.social avatar

Someone who knows and ML: is there a writeup somewhere explaining how first-class modules (a la ML) can do similar things to Haskell type classes? I'm finding it hard to figure that out.

To give a more concrete case: suppose I wanted to write something like Control.Applicative, which provides an 'interface' Applicative with some methods, as well as functions that work for any Applicative. How would I do this with ML-style first-class modules?

jaror,
jaror avatar

@koz I would like to see such a comparison post too. In the meantime I found this stackoverflow question which contains a way to do it using an ML functor: https://stackoverflow.com/questions/48989663/monads-and-sml-modules. The obvious downside is that you have to explicitly state which monad to use at some point.

Another lesser known difference is that I believe you can't instantiate an ML signature with a polymorphic type. For example you can't write an instance of that MAPPABLE signature for a type like Map k v. At least not such that it is still polymorphic over the key type k.

dpwiz,
@dpwiz@qoto.org avatar

@koz Not quite your case, but “The next 500 module systems” paper gives a nice overview of the problem, bridging modules, type classes and records (and scopes!).

haskell,
@haskell@fosstodon.org avatar

"We don’t have too many String types" – The ultimate guide to Strings by Julian Ospald

https://discourse.haskell.org/t/the-ultimate-guide-to-haskell-strings/9538

haskell_foundation,
@haskell_foundation@mastodon.social avatar

The term 'telemetry' can raise a lot of concerns, especially within the realm of . In the latest episode of , Joachim Breitner and Andres Löh interview @avi_press, the CEO of @scarf_oss. Learn more about the episode here: https://haskell.foundation/podcast/47/

haskell, (edited )
@haskell@fosstodon.org avatar

The Cryptography Group calls for early adopters of its , and one-time-password libraries! https://discourse.haskell.org/t/call-for-early-adopters-of-sel-botan-and-one-time-password/9326

mangoiv, German
@mangoiv@functional.cafe avatar

GHC2024 has landed on HEAD and will be part of GHC 9.10, notable changes include:

  • GADTs + MonoLocalBinds
  • DataKinds
  • LambdaCase

Sadly no BlockArguments (Haskeller appear to love their dollars) and TypeData (time hasn’t come I guess)

Also thank god no ImpredicativeTypes and TypeFamilies

https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12084

Also please thank @nomeata for pushing this forward! 👏

jaror,
jaror avatar

@mangoiv what's bad about ImpredicativeTypes?

haskell,
@haskell@fosstodon.org avatar

Read "Botan: The first milestone" on the Cryptography Group's blog: https://haskell-cryptography.org/blog/botan-first-milestone/

kosmikus,
@kosmikus@functional.cafe avatar

At Well-Typed, we are currently looking for a new developer (possibly more) to join our team: https://well-typed.com/blog/2024/04/haskell-development-job-with-well-typed/

haskell,
@haskell@fosstodon.org avatar

Exciting news! Haskell is gearing up to submit a proposal for Google Summer of Code 2024, offering a fantastic chance for everyone to contribute to Open Source projects. We're currently collecting ideas: https://discourse.haskell.org/t/gsoc-2024-call-for-ideas/8485

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

"I recently merged linear let- and where-bindings in GHC. Which means that we’ll have these in GHC 9.10"
🔗 https://www.tweag.io/blog/2024-01-18-linear-desugaring/

lxsameer,
@lxsameer@social.lxsameer.com avatar

I recently came across https://simplex.chat. I really liked it just by reading how it works. But I took a look at the source code today, and I was like: “Oh coool it's in #haskell. Oh, daaaamn they're using #nix quite heavily. I love it. 😍 “

Kudos folks.

@simplex

nomeata,
@nomeata@mastodon.online avatar

I have resigned from my post as GHC Steering Committee secretary, and wrote a little retrospective at https://www.joachim-breitner.de/blog/811-GHC_Steering_Committee_Retrospective

kosmikus,
@kosmikus@functional.cafe avatar

The is now 1 year old! In the anniversary episode, Edsko and I will return to the very first topic and consider (un)folds, but now in a more generic setting. Live on YouTube 2024-05-01 at 1830 UTC.

https://www.youtube.com/watch?v=QTgRKWGDVr0&list=PLD8gywOEY4HaG5VSrKVnHxCptlJv2GAn7&index=24

mangoiv,
@mangoiv@functional.cafe avatar

@kosmikus neat! The anniversary one I’ll have to watch live, I guess! 😅

haskell, (edited )
@haskell@fosstodon.org avatar

Try out the new GHC feature "Diagnostics as JSON", available on the nightly channel!

https://discourse.haskell.org/t/call-for-beta-testers-new-flag-fdiagnostics-as-json/8772

kosmikus,
@kosmikus@functional.cafe avatar

New blog post by my colleague Finley on "Choreographing a dance with the GHC specializer (Part 1)". This is in addition to our episode on the same topic tomorrow, 2024-04-16, at 1830 UTC on YouTube.

https://well-typed.com/blog/2024/04/choreographing-specialization-pt1/

mangoiv, (edited ) German
@mangoiv@functional.cafe avatar

Instead of doing something sensible I spent my Saturday on making an alternative hoogle web frontend with focus on simplicity, prettiness and speed.

Try it out on https://hoogle.mangoiv.com and tell me if you like it.

Code can be found at https://git.mangoiv.com/mangoiv/modern-hoogle

NixOS module pending

mangoiv,
@mangoiv@functional.cafe avatar

Now with open search and sharing of the query

someodd,
@someodd@fosstodon.org avatar

Please share with me your wisdom on packaging and distributing software made with .

simonmic,
@simonmic@fosstodon.org avatar

@someodd, here's a few thoughts on packaging/distribution:

  • Support the widest range of GHC versions, deps, and all related tools you can reasonably manage, reducing unnecessary friction.

  • Get your packages and their dependencies into Stackage nightly and keep them there. From there they will trickle into Stackage LTS, which is a starting point for many packaging systems.

1/

simonmic,
@simonmic@fosstodon.org avatar
  • When you need to provide assets other than the executable, embed them eg with file-embed. The file lookup mechanism provided by Cabal is too fragile.

  • When you want to be cross platform: check your deps, avoid unix-only packages, avoid packages that require external C libs if possible.

2/

  • All
  • Subscribed
  • Moderated
  • Favorites
  • haskell
  • DreamBathrooms
  • mdbf
  • ethstaker
  • magazineikmin
  • GTA5RPClips
  • rosin
  • thenastyranch
  • Youngstown
  • osvaldo12
  • slotface
  • khanakhh
  • kavyap
  • InstantRegret
  • Durango
  • provamag3
  • everett
  • cisconetworking
  • Leos
  • normalnudes
  • cubers
  • modclub
  • ngwrru68w68
  • tacticalgear
  • megavids
  • anitta
  • tester
  • JUstTest
  • lostlight
  • All magazines