Haskell

jaror, in TIL: wrapping list comprehension in a function can prevent fusion
jaror avatar

Stream fusion does work:

data Stream a = forall s. Stream !(s -> Step s a) !s
data Step s a = Yield a !s | Skip !s | Done

data Tup a b = Tup !a !b

cartesianProduct :: Stream a -> Stream b -> Stream (a, b)
cartesianProduct (Stream step1 s01) (Stream step2 s02) = Stream step' s' where
  s' = Tup s01 s02
  step' (Tup s1 s2) =
    case step1 s1 of
      Yield x s1' ->
        case step2 s2 of
          Yield y s2' -> Yield (x, y) (Tup s1 s2')
          Skip s2' -> Skip (Tup s1 s2')
          Done -> Skip (Tup s1' s02)
      Skip s1' -> Skip (Tup s1' s2)
      Done -> Done

eft :: Int -> Int -> Stream Int
eft x y = Stream step x where
  step s
    | s > y = Done
    | otherwise = Yield s (s + 1)

fooS :: Stream (Int, Int)
fooS = cartesianProduct (eft 0 10) (eft 0 10)

toList :: Stream a -> [a]
toList (Stream step s0) = go s0 where
  go !s =
    case step s of
      Yield x s' -> x : go s'
      Skip s' -> go s'
      Done -> []

foo :: [(Int,Int)]
foo = toList fooS
Profpatsch, in Haskell Interlude 44: José Manuel Calderón Trilla
@Profpatsch@mastodon.xyz avatar

@jaror Unfortunately, the rss feed has not yet caught up I feel

jaror,
jaror avatar

That's odd. This latest episode is indeed not mentioned on there: https://feeds.buzzsprout.com/1817535.rss. I'd guess it is something on buzzsprout's side.

Profpatsch,
@Profpatsch@mastodon.xyz avatar

@jaror yeah it's still not up

jaror,
jaror avatar
Mr_Blott, in Issue 406 :: Haskell Weekly newsletter

Aaaawww, I thought it was a weekly roundup of news from everyone’s favourite psychopath, Neil Haskell :(

jaror, in Haskell's problem with exploding call stacks
jaror avatar

Another way to put it is that HasCallStack isn't optimized away by tail call optimization. And Haskell without tail call optimization will have huge stacks.

jaror, in Haskell Interlude 41: Mike Angermann
jaror avatar

The discussion about incentives for stability was interesting. It reminded me of the maintainership standards proposal. I think it would be very useful to have Hackage show information like how quickly a package fixes version bounds when new versions of their dependencies are released.

jaror, in Well-Typed Blog: Haskell Symposium 2023
jaror avatar

Sadly, it seems things are not going so well for the Symposium: https://discourse.haskell.org/t/rfc-changes-to-the-haskell-symposium/8359?u=jaror

mangoiv,
@mangoiv@functional.cafe avatar

@jaror perhaps it would help to not have it be collocated with ICFP which seems to be quite inaccessible.

kosmikus,
@kosmikus@functional.cafe avatar

@mangoiv @jaror Inaccessible in what way? Cost? I doubt not colocating with ICFP would be an advantage, actually. The Haskell Symposium is an academic conference, and there's huge overlap between the audiences of ICFP and the Haskell Symposium. Moving HIW elsewhere sounds plausible to me, moving the Haskell Symposium does not.

mangoiv,
@mangoiv@functional.cafe avatar

@kosmikus @jaror fair - I was just thinking aloud.

jaror,
jaror avatar

Maybe the symposium should start catering more to industrial users, now that Haskell itself also seems to be moving more in that direction (e.g. more backwards compatibility). The symposium already allows experience reports and demos.

kosmikus,
@kosmikus@functional.cafe avatar

@jaror @mangoiv How would catering more to industrial users look like, in your opinion? And why would it be better to change the nature of the Haskell Sympoisum than to simply create / continue a different event? (FWIW, I'm an industrial user for many years now and have always felt very welcome and the Haskell Symposium. But I'm genuinely curious what you think could be done.)

jaror,
jaror avatar

@kosmikus @mangoiv I'm not really the right person to ask, having spent exactly zero time in industry. But I can imagine most industrial users have little interest in the main ICFP program and the other co-hosted workshops. So hosting the event separately at a smaller venue for just two days could make it possible to substantially lower the fees (and individual accommodation costs) which naturally makes the event more accessible. And I expect that the fees are generally a bigger problem outside of academia, so it cater more to industrial users and hobbyists.

kosmikus,
@kosmikus@functional.cafe avatar

@jaror @mangoiv I think compared to many commercial events targeted primarily at industrial users, ICFP + associated workshops is still not overly expensive. What I still don't understand is why it would be better to turn a historically primarily academic conference into something else rather than just try to create a different event. It's a bit sad that HaskellX isn't happening this year for unrelated reasons, but it used to be a good conference that was much less academic. So this can work. But if you decouple Haskell Symposium from ICFP, you'll probably have to re-build it completely anyway, because it'll lose all the academic audience it now automatically gets due to ICFP, and then I'm not sure if the brand is so important that it's better than to use a different one. Also, it's extremely risky. If you moved it away from ICFP, it might not be possible to easily undo that change.

Also, one thing to keep in mind, I don't think Haskell Symposium is suffering from a lack of attendance. It's primarily suffering from a lack of academic paper submissions. Other language workshops co-located with ICFP are mostly less serious (i.e., are encouraging more workshop-like work in progress and don't necessarily require full-paper submissions). Haskell Symposium is in a somewhat strange spot where it requires bascially the same amount of work and effort you'd put into a "full" ICFP submission, but it has much less prestige to people outside of the community that try to quantify the research output of individual researchers in order to decide whether they're worth funding / hiring (which, btw, I hate, but it's nevertheless a reality). So I think the main way to fix this is to either make it less serious as well, or to try make it more prestigious, the former being easier than the latter.

Perhaps making it less serious, but still co-locating with ICFP could also make it more interesting to industrial participants in itself, because it would make it easier for people not part of and familiar with the academic research community to get a presentation slot.

jaror, in [Well-Typed] The Haskell Unfolder Episode 17: circular programs
jaror avatar

This was a fun episode. I was introduced to breadth first labeling and attribute grammars by Doaitse Swierstra at the Applied Functional Programming summer school in Utrecht. He was an inspiring figure.

The biggest disadvantage of circular programs is that it is very easy to get into infinite loops when you make mistakes. I wish there was an easy way to guarantee statically that circular programs are terminating (perhaps using types).

There is also a recent paper about implementing breadth-first traversals without relying on laziness: https://www.cs.ox.ac.uk/people/jeremy.gibbons/publications/traversals.pdf. Unfortunately, that does not contain any benchmarks.

SageBinder,

@jaror Not sure if this is directly related to circular programs, but you may be interested in Aaron Stump’s work on DCS: https://gitlab.com/astump97/dcs/-/blob/main/talks/upenn-fall2023/upenn-talk.pdf?ref_type=heads

underlap, in SBTB 2023: Avi Press, Why Haskell is a Terrible Choice for Startups (And Why We Picked It Anyway)
@underlap@fosstodon.org avatar

@jaror Excellent talk. Thanks @aviaviavi!

aviaviavi,

@underlap @jaror glad you liked it, thanks for watching!

simonmic, in SBTB 2023: Avi Press, Why Haskell is a Terrible Choice for Startups (And Why We Picked It Anyway)
@simonmic@fosstodon.org avatar
jaror,
jaror avatar

What's up?

jaror, in Haskell Interlude 38: Edwin Brady
jaror avatar

I think Idris' bang notation for performing effects in a do-block is pretty, it could look like this:

main = do putStrLn ("You said: " ++ !getLine)

Today, you'd have to come up with a new variable name or figure out the right combinator names:

main = do line <- getLine; putStrLn ("You said: " ++ line)

main = putStrLn . ("You said: " ++) =<< getLine

But unfortunately there are more complicated cases:

main = do print (True || !getLine == "foo")

In a strict language with built-in short-circuiting logical operations the getLine would never be performed, but in Haskell || is just a normal function that happens to be lazy in its second argument. The only reasonable way to implement it seems to be to treat every function as if it was strict and always perform the getLine:

main = do line <- getLine; print (True || line == "foo")

Do you think this is confusing? Or is the bang notation useful enough that you can live with these odd cases? I'm not very happy with this naive desugaring.

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@jaror I never liked it; I think if you can't be bothered to assign a name, point-free combinators are what you should be using.

I also think it gets much uglier or complicated (or both) once you have arguments (unlike getLine, but like most subroutines).

That said, I wouldn't take it away from anyone. I think the desugaring is unsurprising and, at least in a strict language, semantics preserving.

I haven't really spent the necessary time to think clearly through the non-strict case.

bss03,

hachyderm.io/…/111535813328842924 (This might be a duplicate, but I’m not seeing it, on my instance, yet.)

barubary,

@jaror

main = do putStrLn (cycle "buffalo " ++ !getLine)<br></br>
jaror, in The Haskell Unfolder Episode 16: monads and deriving via
jaror avatar

For more details on DerivingVia, check out the paper:

https://ryanglscott.github.io/papers/deriving-via.pdf

Especially Section 4 which lists many use cases including the superclasses demonstrated in the video.

jaror, in ICFP 2023 Videos
jaror avatar
mangoiv, in GHC proposal: Linear constraints
@mangoiv@functional.cafe avatar

@jaror will this interact with any future proposals towards DH? I’m worried that this increase the pile of chores one would have to do to finally reach the goal of implementing them, similarly to how it happened with LinearTypes (and multiplicity polymorphism ftm) themselves.

jaror,
jaror avatar

The changes seem pretty modest as the costs and drawbacks section also says. But I wouldn't know how complicated it is to combine normal constraints with dependent types, let alone linear constraints.

mangoiv,
@mangoiv@functional.cafe avatar

@jaror yeah it seems fine at first; issue is that someone probably has to do the theory part, writing a new papers for every one new addition seems tedious 😅

jaror, (edited ) in Haskell Interlude: Episode 37 – John MacFarlane
jaror avatar

Djot looks very cool: https://djot.net/.

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@jaror SSL_ERROR_BAD_CERT_DOMAIN for me. 😩

jaror,
jaror avatar

Oops, it seems this was my fault, the link should have been https://djot.net

jaror, in GHCup is not an installer · Hasufell's blog
jaror avatar

Affects on maintenance

Is this an example of https://xkcd.com/326/ or is this a typo?

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