haskell / play-haskell

Haskell Playground
125 stars 8 forks source link

Add button to remove template code snippet #32

Closed s-and-witch closed 1 year ago

s-and-witch commented 1 year ago

Feature request

Each time you enter the play.haskell.org site you can see the template code snippet like this:

import Data.List (partition)

main :: IO ()
main = do
  let unsorted = [10,9..1]
  putStrLn $ show $ quicksort unsorted

quicksort :: Ord a => [a] -> [a]
quicksort []     = []
quicksort (x:xs) = let (lesser, greater) = partition (<= x) xs
                   in quicksort lesser ++ [x] ++ quicksort greater

Sometimes it's annoying to remove the code and type the "minimal" main by hand:

main :: IO ()
main = _

So, I'm asking for the button to remove standard template snippet and add the minimal one.

Alternative

Just remove all the template snippets and add hello world as the new one for the :

main :: IO ()
main = putStrLn "Hello, World!"
tomsmeding commented 1 year ago

@s-and-witch You're right, I've had this annoyance as well. I've hacked together a button (live at the usual https://play.haskell.org/); what do you think? It fades away 2 seconds after the user did something (mousemove / keydown) so as to not remain in the way.

s-and-witch commented 1 year ago

That looks fine for me.

tomsmeding commented 1 year ago

Thanks!