maralorn, to haskell
@maralorn@chaos.social avatar

I have real trouble developing an intuition for NoDeepSubsumption.

I always only notice by sheer luck that changing

a . b $ c

to

a $ b $ c

fixes my type error.

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@maralorn I also still have problems with this in , too.

Best tip I have is to pay more attention to the 'forall's. Compose / . / <<< "fixes" the 'forall', which can cause type checking to fail elsewhere or, if "a" is higher-rank, there (it forces "b" to be monomorphic; higher-rank "a" might require a polymorphic "b'). Application / '$' (in GHC) doesn't "fix" the forall.

I think the difference might be "deeper", but for me it's able where the "choice" for the forall is made.

eh, to random
@eh@functional.cafe avatar

What is the best way to start using + halogen with on ARM and macOS? purs-nix seems to only support x86_64. :|

haskman, to javascript
@haskman@functional.cafe avatar

Since the backend post (https://www.moonbitlang.com/blog/js-support) is trending, I thought I'd compare backend optimizer (https://github.com/aristanetworks/purescript-backend-optimizer) output to see how it fares. The results were pretty good!

With basically this PureScript code -

run = fromArray  
 >>> flatMapF (fromArray <<< _.members)  
 >>> filterF _.gender  
 >>> mapF (\x -> min 100 (x.score + 5))  
 >>> mapF grade  
 >>> filterF (_ == 'A')  
 >>> foldF (\_ x -> x+1) 0  

the benchmark results are as follows. PureScript is roughly 6x faster than plain JS, and 6x slower than Moonbit output ( -

┌─────────┬──────────────┬─────────────┬────────────────────┬──────────┬─────────┐  
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │  
├─────────┼──────────────┼─────────────┼────────────────────┼──────────┼─────────┤  
│ 0 │ 'Moonbit' │ '34,67,542' │ 288.38869989829305 │ '±0.06%' │ 1733772 │  
│ 1 │ 'Plain Js' │ '74,816' │ 13365.983827421464 │ '±0.54%' │ 37409 │  
│ 2 │ 'Kotlin Js' │ '1,90,241' │ 5256.474017304151 │ '±0.38%' │ 95121 │  
│ 3 │ 'PureScript' │ '4,99,456' │ 2002.1768597161156 │ '±0.70%' │ 249729 │  
└─────────┴──────────────┴─────────────┴────────────────────┴──────────┴─────────┘  

haskman,
@haskman@functional.cafe avatar

A great example of how cool PureScript backend optimizer is - The PureScript code makes multiple map and filter calls and also calls into two functions with complicated logic. The generated output shows that the PS code was aggressively inlined into a tiny bit of JS code -

on the left : on the right

The tiny bit of JS code that was generated for the above PS code

haskman,
@haskman@functional.cafe avatar
ctietze, to random
@ctietze@mastodon.social avatar

The Magic of Property Testing
https://www.youtube.com/watch?v=4bpc8NpNHRc

@krisajenkins followed up on Property-Based Testing and I love the demo.

Also looks cools

BoydStephenSmithJr, to haskell
@BoydStephenSmithJr@hachyderm.io avatar

Anyone know of an interactive "lambda calculus" expression evaluation site? Or something in that UX neighborhood that I should use for inspiration?

I know I used to answer a lot of questions just by stepping though evaluation. I thought it would be nice to have that on a website and I have a basic expression parser and visualizer in running on my website ("production" is a buggy version, tho) but need to design interactive stepping.

https://gitlab.com/bss03/halogen-lambda

haskman, to FunctionalProgramming
@haskman@functional.cafe avatar

people on : I am now moderating the and communities on Programming.dev.

The best part is that you can also (sort of) follow them from . Search for the following URLs in your mastodon client

https://programming.dev/c/purescript, and https://programming.dev/c/haskell

See you there!

leobm, to random German
@leobm@norden.social avatar

purescript-backend-optimizer
A new optimisation pipeline and alternative modern ES backend for !

https://github.com/aristanetworks/purescript-backend-optimizer?tab=readme-ov-file

leobm, to haskell German
@leobm@norden.social avatar

Basically, I understand the concepts of functional programming quite well and can also programme or relatively confidently. But when it comes to programming, I haven't quite got over this threshold yet. I would really like to understand everything better and learn more in this area, because many cool libraries are based on it.

englishm, to InitialD

Time for a new !

Hi all, I'm Mike!

I'm a software developer working in the streaming space. Specifically, I've been working on Media over QUIC (MoQ), , and other "ultra low latency" technologies. I write , , and at work these days.

I'm still living the and now work for a distributed London-based company from the woods of .

In my free time I enjoy and playing games with my family, and playing with radio waves.

tintvrtkovic, to random
@tintvrtkovic@mastodon.social avatar

Alright, day 4 of in done. It was actually easier than day 3; day 3 input was harder to parse since the positions of tokens mattered.

I don't know about other stuff but AoC is really cool for learning languages from scratch. I've used PureScript about 5 years go so I'm not a complete beginner but I can still feel my proficiency increase with each day.

One thing that's unfortunate about PureScript is that it's really amenable to golfing and I'm too weak to resist.

Pdragos, to haskell
haskman, to rust
@haskman@functional.cafe avatar

Rant: I personally find to be in a weird space where you don't have as great a type system as Haskell's, and don't even get safety from arbitrary mutation. Atleast gives me things that doesn't.

A strict Haskell, with some warts removed would go a long way towards fixing Haskell's image problems. is that Haskell, but it gets dismissed as something solely for the web. A mature native backend for PureScript would be amazing as well.

ljrk, to typescript
@ljrk@todon.eu avatar

For anyone wondering how to use ts-bridge to create more type-safe contracts for calling from (and not the other way around as described in the docs), the developer put up a blog post on that:

https://thought2.github.io/blog/purescript-ffi/

brokenix, to haskell

doesn't have -like records at all. They just wrap anonymous records into newtypes
https://blog.monadfix.com/nau-2-records

leobm, to haskell German
@leobm@norden.social avatar
hongminhee, to haskell
@hongminhee@todon.eu avatar

This is why I've considered as a decent alternative to , but it's overly centered on the web and Node.js (it has a Go/C++ backend, but it's never a first-class citizen), and the lack of momentum due to the size of the community makes me scared to bet on it. 😇

https://journal.infinitenegativeutility.com/leaving-haskell-behind

SusanPotter, to haskell
@SusanPotter@mastodon.social avatar

I have just been requested to commute three days a week 135 miles away each way from my home (I have not moved) to an office I was never required to attend before the pandemic starting end of September.

If anyone needs remote product/infrastructure/platform engineering or backend developer who has 15 years cloud deployment experience and data center to cloud migration experience, email me on spotter@referentiallabs.com.

haskman, to typescript
@haskman@functional.cafe avatar

Sounds like people are asking for TypeRep support?

A lot of people in this thread seem to think that requires some sort of a runtime reflection, but it's all compile time. as well as erase types at compile time and TypeReps work well there.

https://news.ycombinator.com/item?id=36637221

haskman, to random
@haskman@functional.cafe avatar

has merged Visible Type Applications! Really looking forward to using this!

https://github.com/purescript/purescript/pull/4436

rml, to random
@rml@functional.cafe avatar
haskman, to random
@haskman@functional.cafe avatar
haskman, to programming
@haskman@functional.cafe avatar

is almost the perfect replacement. Not only for the things it brings to the table, but also for the things it does not.

I mean actual features missing from PureScript and not gotchas like no historical baggage!

Some examples below. All of them are good for simplicity and newbie friendliness!

  1. No laziness.

Laziness makes it harder to reason about performance. There are easy workarounds for most common usecases for laziness, and employing clever laziness tricks is usually not worth the cost of complicating the codebase.

Also, you can approximate thunks with functions when needed. Typeclass trickery even allows call-by-name evaluation (see https://github.com/natefaubion/purescript-call-by-name).

  1. Manual recursion is discouraged.

PureScript's TCO only works in special cases. Normally you wouldn't even need to deal with this because existing implementations of functions like map, foldr etc. are already tail recursion safe. For the rare cases when you need to manually recurse, you can use tailRec and tailRecM to ensure stack safety.

  1. No special syntax or support for linked lists. Strings are not simply lists of chars.

This could potentially be put in the "no historical baggage" category. But I feel that a lot of people, especially newbies, view the special treatment of lists and strings as a plus for Haskell.

However, the focus on lists causes massive confusion for newbies when they are encouraged to use types like Vector and Text in production instead. The special inbuilt syntax also is an active impediment for learning (for example, how do you refer to the higher kinded List type when deriving an instance? It's a mental leap to get to [] in instance Foo [] where).

  1. No special syntax for Tuples.

Much of what was said for lists also applies to tuples. The special syntax is confusing to newbies and causes code complications. For example, each length of tuple is a separate type, and typeclasses in Haskell need to derive instances for each separately. They usually derive instances for tuples only up to length 7.

In addition, it's rarely needed. I am yet to find a usecase for tuples where PureScript's wonderful support for records doesn't suffice. I thought one such usecase was case matching on multiple values (case (v1, v2) of ...), but PureScript supports multi case match for this exact usecase and avoids unnecessary boxing (In PureScript you would write case v1, v2 of ...).

BoydStephenSmithJr, to haskell
@BoydStephenSmithJr@hachyderm.io avatar

Note to self: type variables in and cannot be bound to partially applied type synonyms.

If you try to do so, in a sufficiently polymorphic way, you'll get very confusing type errors as the checker attempts to solve things with the variable bound to the "head" of the (parametrically expanded) type alias.

Last night it was (forall r. (forall f. Foldable1 f => f a -> r) -> r) and tonight it was (a -> Term a). Introducing a newtype can help, but beware impredicativity.

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