Posts

This profile is from a federated server and may be incomplete. Browse more on the original instance.

DiazCarrete, to haskell
@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/

DiazCarrete, to haskell
@DiazCarrete@hachyderm.io avatar
DiazCarrete,
@DiazCarrete@hachyderm.io avatar

Found this lexi_lambda video about worker/wrapper which gives an example of optimizing records away:
https://youtu.be/XiTO1EGKrhE?t=1030

DiazCarrete, to haskell
@DiazCarrete@hachyderm.io avatar

The library lets you construct queries using a monadic interface.

Interesting bit: "Rel8 has a fairly unique feature in that it’s able to return not just lists of rows, but can also return trees."

https://rel8.readthedocs.io/en/latest/cookbook.html#tree-like-queries

image/png

mangoiv,
@mangoiv@functional.cafe avatar

@DiazCarrete admittedly this was on a fairly weak machine

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

Post about Entity Framework, touching on how to extract across a foreign key relationship
https://blog.ploeh.dk/2023/09/18/do-orms-reduce-the-need-for-mapping/
https://twitter.com/ploeh/status/1703782709422657939

DiazCarrete, to random
@DiazCarrete@hachyderm.io avatar
DiazCarrete, to random
@DiazCarrete@hachyderm.io avatar

Interesting: it seems that is moving towards typechecking desugared expressions in some cases, instead of typechecking the surface syntax.

The tricky part is not making the error messages worse.

https://youtu.be/LFIL0myeOlo?list=PLyrlk8Xaylp5ahGXwF_NvYEhVOnedRIAs&t=469

DiazCarrete, to haskell
@DiazCarrete@hachyderm.io avatar

"the very definition of the GHC profiler makes it of limited use when estimating time on two classes of computations: firstly, those that need to do blocking IO; and secondly, some computations that invoke functions written in other programming languages."
https://www.tweag.io/blog/2022-07-28-timestats/
Sometimes you have to turn to the eventlog
https://well-typed.com/blog/2019/09/eventful-ghc/
https://hackage.haskell.org/package/ghc-events
https://downloads.haskell.org/ghc/latest/docs/users_guide/eventlog-formats.html

DiazCarrete, to haskell
@DiazCarrete@hachyderm.io avatar
DiazCarrete, to haskell
@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

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

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

DiazCarrete, to haskell
@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, to haskell
@DiazCarrete@hachyderm.io avatar

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

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.

DiazCarrete, to haskell
@DiazCarrete@hachyderm.io avatar
jaror,
jaror avatar

@DiazCarrete I don't think I'd want to change the string type that often, but being able to make it be a specific type instead of having it be overloaded would be nice.

DiazCarrete, to random
@DiazCarrete@hachyderm.io avatar

If your branch has a good number of commits since it diverged from main, rebasing can sometimes seem like a Sisyphean task. Because each commit is applied independently, you often end up resolving merge conflicts again and again in the same places, conflicts that a merge would make you resolve together in one go.

To avoid that, I sometimes squash together all the commits in my branch before rebasing on top of main. But then of course I lose the structure of the separate commits.

DiazCarrete,
@DiazCarrete@hachyderm.io avatar

@nshephard Actually, I've found some links that talk about rerere helping even for single rebases (?) so maybe I'm wrong. But I'm still unsure about why it would work 🤔

🔗 https://mindup.medium.com/enable-git-rerere-for-easy-merging-303c6f2dacd3
🔗 https://stackoverflow.com/questions/10601541/smarter-rebase-avoiding-redundant-work

DiazCarrete,
@DiazCarrete@hachyderm.io avatar
DiazCarrete, to haskell
@DiazCarrete@hachyderm.io avatar

> writes dynamically typed code example
> only compiles it, doesn't even run it once 🤷
🔗 https://discourse.haskell.org/t/implementing-type-safe-heterogeneous-collections/8605/5
🔗 https://github.com/danidiaz/toyframes/blob/main/README.md

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

Still getting the hang of pattern synonyms.

🔗 https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/pattern_synonyms.html
🔗 https://gitlab.haskell.org/ghc/ghc/-/wikis/pattern-synonyms#explicitly-bidirectional-pattern-synonyms
the paper 🔗 https://repository.brynmawr.edu/compsci_pubs/68/

It seems that, if you want to check for some value-level condition when matching, you need to bring in ViewPatterns. This is mentioned in the wiki but not (explicitly) in the GHC user guide.

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