Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Smoke_Max
Sep 7, 2011

Hi, Haskell newbie here. I was wondering why main doesn't have a [String] -> IO () type signature like other programming languages, like C/C++ or Java. It would be pretty cool, thanks to pattern matching, to be able to do things like this:

code:
main [arg1, arg2] = ...

main _ = do
	name <- getProgName
	putStrLn ("usage: " ++ name ++ " arg1 arg2")

Smoke_Max fucked around with this message at 15:42 on Jun 3, 2015

Adbot
ADBOT LOVES YOU

Smoke_Max
Sep 7, 2011

I find refinement typing (such as LiquidHaskell) to be a pretty good compromise between power and usability. Just being able to say simple things like "this integer argument is positive and less than 100" without having to pass around a billion proofs between functions is great for me.

Smoke_Max fucked around with this message at 14:32 on Dec 18, 2016

Smoke_Max
Sep 7, 2011

I just read about the FTP controversy in Haskell and it seemed to me to have been a solid move, but one detail is still nagging me. What's the rationale behind (,)'s Foldable instance? I understand how it works, but why is it even defined? Is it a case of "because we can"? I honestly cannot see much use for it besides creating confusion (length (1, 2) = 1 says hi). Personally, by making well typed code do the wrong thing, all it does for me is make me less confident in the type checker.

(As an aside, why did it stop at (,)? What about (,,), (,,,), etc.?)

  • Locked thread