BoydStephenSmithJr, to haskell
@BoydStephenSmithJr@hachyderm.io avatar

Note to self: type variables in #purescript and #haskell 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.

eh, to random
@eh@functional.cafe avatar

What is the best way to start using #purescript + halogen with #nix 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
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

BoydStephenSmithJr, to fediverse
@BoydStephenSmithJr@hachyderm.io avatar

So, I finished my first coding and music stream on https://video.infosec.exchange/w/hmradyAMD5rJ6LKWVUiJLk if you want to watch someone fight type errors around right Kan extensions in enjoy!

I think next time I might not start in the middle of a large project. Needs to be more like Joy of Painting and start with a blank "canvas". Probably just grab a problem from the cyber-dojo and plug at it.

Let me know if the music is too loud or the font to unreadable.

abucci, to ProgrammingLanguages
@abucci@buc.ci avatar

A weird thing about being 50 is that there are programming languages that I've used regularly for longer than some of the software developers I work with have been alive. I first wrote BASIC code in the 1980s. The first time I wrote an expression evaluator--a fairly standard programming puzzle or homework--was in 1990. I wrote it in Pascal for an undergraduate homework assignment. I first wrote perl in the early 1990s, when it was still perl 4.036 (5.38.2 now). I first wrote java in 1995-ish, when it was still java 1.0 (1.21 now). I first wrote scala, which I still use for most things today, in 2013-ish, when it was still scala 2.8 (3.4.0 now). At various times I've been "fluent" in 8086 assembly, BASIC, C, Pascal, perl, python, java, scala; and passable in LISP/Scheme, Prolog, old school Mathematica, (early days) Objective C, matlab/octave, and R. I've written a few lines of Fortran and more than a few lines of COBOL that I ran in a production system once. I could probably write a bit of Haskell if pressed but for some reason I really dislike its syntax so I've never been enthusiastic about learning it well. I've experimented with Clean, Flix, Curry, Unison, Factor, and Joy and learned bits and pieces of each of those. I'm trying to decide whether I should try learning Idris, Agda, and/or Lean. I'm pretty sure I'm forgetting a few languages. Bit of 6502 assembly long ago. Bit of Unix/Linux shell scripting languages (old enough to have lived and breathed tcsh before switching to bash; I use fish now mostly).

When I say passable: in graduate school I wrote a Prolog interpreter in java (including parsing source code or REPL input), within which I could run the classic examples like append or (very simple) symbolic differentiation/integration. As an undergraduate I wrote a Mathematica program to solve the word recognition problem for context-free formal languages. But I'd need some study time to be able to write these languages again.

I don't know what the hell prompted me to reminisce about programming languages. I hope it doesn't come off as a humblebrag but rather like old guy spinning yarns. I think I've been through so many because I'm never quite happy with any one of them and because I've had a varied career that started when I was pretty young.

I guess I'm also half hoping to find people on here who have similar interests so I'm going to riddle this post with hashtags:

#C #R

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@abucci I didn't write an interpreter until college, but I also started with BASIC in the 80s.

Currently writing for work and (and Haskell) when I'm not on the clock. Previously did everything from PHP or PowerBuilder to C and C++ to Java and Scala or C#.

Really want a practical language based on Graded Modal Dependent Type Theory so putting some of my spare cycles into playing with that. Interested in having safe+easy lexical capture AND GC-free execution regions.

BoydStephenSmithJr, to haskell
@BoydStephenSmithJr@hachyderm.io avatar

Anyone want to volunteer a guide for when to use instead of in or ?

I'm wanting to provide an HFunctor (https://pursuit.purescript.org/packages/purescript-fix-functor/0.1.0/docs/FixFunctor#t:HFunctor) instance but the naive way to do that requires me to "invent" a Functor instance for the source type constructor -- thinking of adding a yoneda/coyoneda wrapper and I think either would work, but I'm not sure.

Profpatsch, to typescript
@Profpatsch@mastodon.xyz avatar

Okay, so

After spending some time with , going back to is a real hard sell, ngl

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@Profpatsch Oof, pass. I got really stoked around typescript for a little while, but they stopped maintaining the spec, and these days I greatly prefer if I have to target a browser and have a choice. (It doesn't have a spec either, but I find it a much nicer language.)

At work, we still just do JS, but that's because it's likely to come out of a julius splice from .

BoydStephenSmithJr, to random
@BoydStephenSmithJr@hachyderm.io avatar

Bah, doesn't call it "strict positivity", but it doesn't let me violate that and derive Functor. Sometimes I think the "efficient DeBruijn" of 's Scope gets paid for in programmer time. :blobfoxlaughsweat:

BoydStephenSmithJr, to haskell
@BoydStephenSmithJr@hachyderm.io avatar

Any experience with turning non-uniform recursion schemes (http://www.cs.nott.ac.uk/Research/fop/blampied-thesis.pdf) into a library that works like or -schemes

I've got a specific type that uses a approach but I'd like to write some general folds (using e.g. algebra families) instead of duplicating the "traversal" code.

I might have done the categorical approach (functor categories instead of algebra families) before, but that has limitations and I think I lost the code.

norootcause, to random
@norootcause@hachyderm.io avatar

Sometimes I think we could use some further ado.

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar
BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@tuban_muzuru @norootcause If you want to see how a small hack-y SPA looks in it, I volunteer my current idle project: https://gitlab.com/bss03/halogen-lambda

If reading the code isn't enough, the ugly SPA with crappy UX is at least live: https://bss03.gitlab.io/halogen-lambda/

Having to deal with type conflicts at runtime is exhausting to me. Writing non-trivial JS at work is a slog. But, I'd say is almost as much fun as and might be better-specified!

BoydStephenSmithJr, to random
@BoydStephenSmithJr@hachyderm.io avatar

Updated my ugly-ass lambda calculus thing on my website (https://www.iguanasuicide.net/) and now you can click the name of the reduction to perform it.

BoydStephenSmithJr, to random
@BoydStephenSmithJr@hachyderm.io avatar

Mildly disappointed that spago@next is using YAML instead of Dhall. :blobfoxannoyed:

I'm going to hold off as long as possible, but I do want to figure out how to get source maps working, with or without parcel.

BoydStephenSmithJr, to random
@BoydStephenSmithJr@hachyderm.io avatar

I got around to adding bounds-checking to my interactive lambda-calculus toy: https://bss03.gitlab.io/halogen-lambda/

I need to change the bounds-checking component to use an AST next.

Then, step-wise evaluation, if bounds-checking passes.

I really like the framework for SPAs.

BoydStephenSmithJr, to random
@BoydStephenSmithJr@hachyderm.io avatar

What's the easiest way to put my application on my website? Even better if I can easily install it as a sub-site?

My current method is barely remembered, haphazard, and also breaks as soon as I put it not at the root (can't find CSS / JS, I think?).

Alternatively, I'd also be open to using pages; the main repository is already hosted there.

BoydStephenSmithJr, to haskell
@BoydStephenSmithJr@hachyderm.io avatar

Typed holes (in or GHC or wherever) are just too useful. I don't know how to operate in higher-order / heavily polymorphic code without them anymore. :blobfoxgooglyconfused:

Writing a new language is hard... so much to implement before I'm even willing to use it myself! 😜

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.

leobm,
@leobm@norden.social avatar

Unfortunately, there isn't that much documentation or tutorials for dummies, i.e. for people like me. A few days ago I found a really cool introduction to the basics here. I would like to see more tutorials like this. https://blog.wuct.me/fun-with-typed-type-level-programming-in-purescript-5f8af42cfec5

pitmutt, to haskell
@pitmutt@zeal.center avatar

Building a website is much more fun when you use functional programming

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@pitmutt If you haven't tried it, yet, try and Halogen for your rich pages or SPAs. (I still prefer Haskell for routing, non-trivial backend, or multi-endpoint APIs; Servant is great.)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • normalnudes
  • osvaldo12
  • magazineikmin
  • vwfavf
  • thenastyranch
  • Youngstown
  • slotface
  • Durango
  • ngwrru68w68
  • rosin
  • kavyap
  • tsrsr
  • PowerRangers
  • DreamBathrooms
  • Leos
  • khanakhh
  • hgfsjryuu7
  • cubers
  • everett
  • cisconetworking
  • InstantRegret
  • mdbf
  • tacticalgear
  • ethstaker
  • tester
  • modclub
  • GTA5RPClips
  • anitta
  • All magazines