Haskell

BoydStephenSmithJr, (edited )
@BoydStephenSmithJr@hachyderm.io avatar

Hey, , what's the more conservative extension to the report?

I think I can do what I want either way, but I don't really know how to do it in Haskell2010 with no extensions. (I have a non-parameteric type function/family in my semantics, and don't want to give up totality.)

18+ kosmikus,
@kosmikus@functional.cafe avatar

@BoydStephenSmithJr I voted RankNTypes. Arguments in favour: RankNTypes (or at least Rank2Types) existed long before GADTs, and RankNTypes can be translated into "plain" Fω Core, without needing any equality constraints like FC.

joeyh,
@joeyh@hachyderm.io avatar

Last week I prototyped a git remote helper in a shell script, and now I'm rewriting that in as part of .

I don't do this often and I wonder if it was a mistake, probably I should have written the prototype in haskell and then integrated it into git-annex. It's kind of amazing how a lot of complexity is melting away and also how I'm adding So Many Types and also throwing in a lot of robustness improvements.

joeyh,
@joeyh@hachyderm.io avatar

This reminds me of when I rewrote all of debhelper from shell to perl in a couple days way back when.

mangoiv,
@mangoiv@functional.cafe avatar

Out:
(A -> D) -> B -> C -> D

In:
(A -> (D, B, C) ) -> D

#haskell

mangoiv,
@mangoiv@functional.cafe avatar

I just realised in my real life example it is worse because d is an unconstrained type variable

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@mangoiv Higher ranked types, FTW?

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

Haskellers can have a little UwU, as a treat.
https://haskell.org/?uwu=true

yujiri,
@yujiri@freeradical.zone avatar

@haskell nitpick: those are kana, not kanji. kanji are the logographic characters

haskell,
@haskell@fosstodon.org avatar

@yujiri Thanks!

maralorn,
@maralorn@chaos.social avatar

I would like to see CNN style real time coverage of software releases, e.g.:

BREAKING: New ghc release just dropped!

pomCountyIrregs,
@pomCountyIrregs@mstdn.social avatar

@maralorn When a showstopper bug/security flaw is found, would it be “BREAKING: {$sw} broken”?

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

Made a video: generating HTML in Haskell using "lucid2"
https://www.youtube.com/watch?v=SQ78GVCzsz0

#Haskell #HTML

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

In which I completely mispronounce "lucid", among many other words.

mangoiv,
@mangoiv@functional.cafe avatar

Shoutout to @hecate for https://flora.pm/.

It’s just so awesome to have a fast, modern UI for hackage that really suits all your needs!

#haskell

flora_pm,
@flora_pm@functional.cafe avatar

@mangoiv cheers 👍

lyxia,
@lyxia@mamot.fr avatar

Bluefin-algae, an algebraic effect library using the Bluefin effect system. #Haskell
https://discourse.haskell.org/t/bluefin-algae-algebraic-effects-in-bluefin/9470

mangoiv,
@mangoiv@functional.cafe avatar

@lyxia finally someone uses the native delconts! ❤️
Thank you for making this :)

koz,
@koz@chaos.social avatar

Fedi: do int2Word# and similar operations have a runtime cost? I assume 'no', but I'd like to be sure.

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@koz I'm not sure but I think https://github.com/ghc/ghc/blob/bf3d4db0894233ec72f092a4a34bce9ed4ff4e21/compiler/GHC/Builtin/primops.txt.pp#L817 says that actually no code is emitted for that prim op, which would mean no runtime cost.

Hopefully, a expert will come through and confirm or correct me.

Of course, that's not part of the language spec, or the public API of GHC, so it could change on a whim. (It won't.)

Jose_A_Alonso,
@Jose_A_Alonso@mathstodon.xyz avatar

The Haskell Unfolder Episode 24: generic (un)folds. ~ Edsko de Vries (@EdskoDeVries), Andres Löh (@kosmikus). https://www.youtube.com/live/QTgRKWGDVr0 #Haskell #FunctionalProgramming

kosmikus,
@kosmikus@functional.cafe avatar

The one-year anniversary episode of the #Haskell #Unfolder is starting in about 15 minutes!

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

kosmikus,
@kosmikus@functional.cafe avatar
tristanC,
@tristanC@functional.cafe avatar

@kosmikus Thank you and Edsko, you made folds look oh so easy!

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

lots of info about HKD techniques in this thread

https://discourse.haskell.org/t/hkd-best-or-worst-thing-ever/9450

#haskell

DiazCarrete,
@DiazCarrete@hachyderm.io avatar
DiazCarrete, (edited )
@DiazCarrete@hachyderm.io avatar

Generating safe links for your REST API with Servant
https://youtu.be/KC64Ymo63hQ?si=I_E17cwA0UBQfmAF

#haskell

kosmikus,
@kosmikus@functional.cafe avatar

The #Haskell #Unfolder 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! 😅

hackuador,
@hackuador@functional.cafe avatar

Brisbane Functional Programming Group May meetup, Tue 14th: v1 (Rob Ellen) + Do your taxes with (Fraser Tweedale). All curious minds are welcome!

https://www.meetup.com/brisbane-functional-programming-group/events/298454561/

mybarkingdogs,
@mybarkingdogs@freeradical.zone avatar

, , National Weather Service: WARNING in this area until 11:15 PM CDT. Take shelter now in a basement or an interior room on the lowest floor of a sturdy building. If you are outdoors, in a mobile home, or in a vehicle, move to the closest substantial shelter and protect yourself from flying debris. Check media. Source: NWS San Angelo TX

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

AFAIK, there's not an easy way in Haskell to inspect at the type level what type a field has in a record.

What I mean is that that there doesn't seem to be a type family like

type FieldType :: Type -> Symbol -> Type

that we could invoke in ghci like

:kind! FieldType Person "age"

Why would I want this? For libraries like servant and rel8 that use parameterized records where the types of the fields vary heavily with the type parameter.

I guess I could hack it using generics. 🤔

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

"hack it using generics"
^ oh god, my poor memory. I actually did already implement something like this back in the day, using generics.

https://hackage.haskell.org/package/red-black-record-2.1.4.0/docs/Data-RBR.html#t:Value

DiazCarrete,
@DiazCarrete@hachyderm.io avatar
brokenix,

quoting @prophet
mli files are mostly used to constrain the visibility of definitions whereas hs-boot files are about allowing mutual recursion between modules (which OCaml doesn't support, even with mli files!)
But the mechanism by which they achieve their goals is nearly identical even though the perception of it is so vastly different.

I guess the conclusion to draw from this is that both sides are wrong: IMO, mli files are not nearly as good as OCamlers think they are, but hs-boot files aren't as ugly as Haskellers think either.
-- prettySrcLoc and prettyCallStack are defined here to avoid hs-boot
-- files. See Note [Definition of CallStack]

Backpack's design is primarily driven by compatibility considerations (“how do we build upon GHC's existing foundation?”), rather than elegance. In particular, Backpack doesn't eliminate those ugly .hs-boot files, it just automates and hides their generation and processing.

For all their faults, Standard ML and OCaml have pretty good support for modular programming. And, as the Modular Type Classes paper you linked shows, type classes can be built elegantly on top of a good modular foundation.

https://cohost.org/prophet/post/3251638-it-s-really-interest
https://haskell.fi.muni.cz/doc/base/src/GHC-Exception.html
https://twitter.com/lexi_lambda/status/1172629363730333697
https://news.ycombinator.com/item?id=11371130

sgraf,
@sgraf@mastodon.online avatar
someodd,
@someodd@fosstodon.org avatar

Do you as a language, lends itself to fast prototyping and iteration?

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

In Servant, the ServerError type has an Exception instance
https://hackage.haskell.org/package/servant-server-0.20/docs/Servant-Server.html#t:ServerError
You might speculate that when throwing a ServerError using liftIO . throwIO in a Handler, the ServerError is automatically caught and served as a response, but it ain't so: it's treated as just another exception, and the response code is 500.

Instead, you should throw ServerErrors using "throwError", re-exported from the "Servant" module.
https://hackage.haskell.org/package/servant-server-0.20/docs/Servant.html#v:throwError

#haskell

image/png

DiazCarrete, (edited )
@DiazCarrete@hachyderm.io avatar

@BoydStephenSmithJr I don't think it's a bad idea!

I believe we can impement in Servant the throwIO behavior I mentioned earlier by catching (some) runtime exceptions in the callback passed to "hoistServer" and re-throwing them in the "proper" way expected by Handler. https://hackage.haskell.org/package/servant-server-0.20/docs/Servant-Server.html#v:hoistServer

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@DiazCarrete I think that universally quantified x might be a problem, but I suppose it depends on the type of your re-throw mechanism.

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

friendship ended with ScopedTypeVariables, TypeAbstractions is my new best friend
https://serokell.io/blog/ghc-dependent-types-in-haskell-3

#haskell

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

@DiazCarrete That's what I do, yes. newtype Semantic2 = MkSemantic2 { unSemantic2 :: Semantic1 }

Though sometimes I do something different, like newtype Subset = AssertSubset { asSuperset :: Superset } for things where the rep. sharing is more practical, even if the syntax isn't actually the same, like Email/Text or PhoneNumber/Int64 since construction will generally be through something like isEmail :: Text -> Either ParseFailure Email or inputPhone :: Natural -> Maybe PhoneNumber

kosmikus,
@kosmikus@functional.cafe avatar

@DiazCarrete I think both are nice to have.

vascorsd,
@vascorsd@mastodon.social avatar
vascorsd,
@vascorsd@mastodon.social avatar

Effectful - An easy to use, fast extensible effects library with seamless integration with the existing Haskell ecosystem.

https://flora.pm/packages/@hackage/effectful

[Well-Typed Blog] Improvements to the ghc-debug terminal interface (www.well-typed.com)

ghc-debug is a debugging tool for performing precise heap analysis of Haskell programs (check out our previous post introducing it). While working on Eras Profiling, we took the opportunity to make some much needed improvements and quality of life fixes to both the ghc-debug library and the...

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

> none of the modifying functors are the same as the type being defined, that is, we do not consider non-linear non-uniform recursion

Oh, fiddlesticks. I've been trying to use this paper for non-linear recursion. I think I might have to invent/discover instead of just mimic. I'm not as good at that! :P

Please send me your best references for non-linear non-uniform recursion since Blampied2000. Bonus points for code, but categorical abstract nonsense is fine, too.

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

Johann, P. and Ghani, N. (2007). Initial Algebra Semantics Is Enough! seems to simplify things (by using Kan extensions, that I still don't feel like I ""get") but doesn't actually provide an example of a non-linear non-uniform recursive type / non-linear nested type.

BoydStephenSmithJr,
@BoydStephenSmithJr@hachyderm.io avatar

Ghani, Neil and Johann, Patricia (2009) Haskell programming with nested types: a principled
approach does seem to have a non-linear example.

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