All the side effects were never mentioned to me
I am innocent of uncontrolled abuse

  • 129 Posts
  • 33 Comments
Joined 1 year ago
cake
Cake day: June 17th, 2023

help-circle
























  • @kosmikus @mangoiv I’m not really the right person to ask, having spent exactly zero time in industry. But I can imagine most industrial users have little interest in the main ICFP program and the other co-hosted workshops. So hosting the event separately at a smaller venue for just two days could make it possible to substantially lower the fees (and individual accommodation costs) which naturally makes the event more accessible. And I expect that the fees are generally a bigger problem outside of academia, so it cater more to industrial users and hobbyists.





  • I think Idris’ bang notation for performing effects in a do-block is pretty, it could look like this:

    main = do putStrLn ("You said: " ++ !getLine)
    
    

    Today, you’d have to come up with a new variable name or figure out the right combinator names:

    main = do line <- getLine; putStrLn ("You said: " ++ line)
    
    main = putStrLn . ("You said: " ++) =<< getLine
    
    

    But unfortunately there are more complicated cases:

    main = do print (True || !getLine == "foo")
    
    

    In a strict language with built-in short-circuiting logical operations the getLine would never be performed, but in Haskell || is just a normal function that happens to be lazy in its second argument. The only reasonable way to implement it seems to be to treat every function as if it was strict and always perform the getLine:

    main = do line <- getLine; print (True || line == "foo")
    
    

    Do you think this is confusing? Or is the bang notation useful enough that you can live with these odd cases? I’m not very happy with this naive desugaring.







  • There are so many options to work around type classes. As you say, we could be looser with our types and have one general number type that includes integers and floats. (And I don’t even think array indexing is much of a problem, it could just throw an error or automatically round to an integer.)

    Another option is to just have separate number types with separate functions for addition and multiplication etc. For example OCaml has + and +..

    Perhaps more of a stepping stone towards full type classes would be a limited system where only a few pre-defined classes and instances exist. Then you’ll never run into the dreadful could not deduce Num (a -> b) error message, but you can still use a nice overloaded + for both Int and Double.