this post was submitted on 10 Feb 2024
606 points (100.0% liked)

196

16450 readers
2383 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Solrac@lemmy.world 72 points 9 months ago (6 children)

Finally, someone understands that Allman is not that great, and that Kernighan & Ritchie is the way to go. Also, Haskell, my guy, you good? Lisp, are you ok? Do I need to call your parents?

[–] v_krishna@lemmy.ml 37 points 9 months ago

Do I need to call your parens*

[–] MechanicalJester@lemm.ee 30 points 9 months ago

Allman all the way baybeeee

[–] gerryflap@feddit.nl 10 points 9 months ago (1 children)

I've written Haskell quite a bit, and I don't fully understand why this is called Haskell style. Haskell code looks nothing like this, the syntax is completely different. For Haskell's syntax I think it works fine, because I never noticed something weird. But this code in "Haskell style" looks absolutely insane

[–] t_veor@sopuli.xyz 11 points 9 months ago

It's sometimes called comma-leading style where you move all the special characters to the front of the line and it is exceedingly common in Haskell, possibly due to how Haskell treats significant whitespace. You've surely seen list definitions that look like this:

someList =
  [ 1
  , 2
  , 3
  ] 

or a data definition like this:

data Color
  = Red
  | Green
  | Blue
  | RGB Int Int Int
  deriving (Show, Eq)

or a list of module exports like this:

module Foo
  { bar
  , baz
  , quux
  } 

Or in a long function type declaration where the arrows are moved to the start of the line, or a record definition, etc. etc.

[–] Phoenix3875@lemmy.world 5 points 9 months ago

Meh, it's what you get when you write a language in a different language's "style".

[–] brown567@sh.itjust.works 2 points 9 months ago

You should see how a Lisper writes in their native language

They are super extra not okay