Skip to content

Commit 47d38db

Browse files
authored
Merge pull request #106 from codecrafters-io/bump-bun-version
CC-1491: Disable stderr/out buffering for Haskell starter code
2 parents d14bc43 + e62211c commit 47d38db

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

compiled_starters/haskell/app/Main.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ module Main (main) where
55
import Control.Monad (forever)
66
import qualified Data.ByteString.Char8 as BC
77
import Network.Socket
8-
import System.IO (BufferMode (..), hSetBuffering, stdout)
8+
import System.IO (BufferMode (NoBuffering), hSetBuffering, stdout, stderr)
99

1010
main :: IO ()
1111
main = do
12-
hSetBuffering stdout LineBuffering
12+
-- Disable output buffering
13+
hSetBuffering stdout NoBuffering
14+
hSetBuffering stderr NoBuffering
1315

1416
-- You can use print statements as follows for debugging, they'll be visible when running tests.
1517
BC.putStrLn "Logs from your program will appear here"

solutions/haskell/01-at4/code/app/Main.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ module Main (main) where
55
import Control.Monad (forever)
66
import qualified Data.ByteString.Char8 as BC
77
import Network.Socket
8-
import System.IO (BufferMode (..), hSetBuffering, stdout)
8+
import System.IO (BufferMode (NoBuffering), hSetBuffering, stdout, stderr)
99

1010
main :: IO ()
1111
main = do
12-
hSetBuffering stdout LineBuffering
12+
-- Disable output buffering
13+
hSetBuffering stdout NoBuffering
14+
hSetBuffering stderr NoBuffering
1315

1416
let host = "127.0.0.1"
1517
port = "4221"

solutions/haskell/01-at4/diff/app/Main.hs.diff

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
@@ -1,36 +1,32 @@
1+
@@ -1,38 +1,34 @@
22
{-# LANGUAGE OverloadedStrings #-}
33

44
module Main (main) where
55

66
import Control.Monad (forever)
77
import qualified Data.ByteString.Char8 as BC
88
import Network.Socket
9-
import System.IO (BufferMode (..), hSetBuffering, stdout)
9+
import System.IO (BufferMode (NoBuffering), hSetBuffering, stdout, stderr)
1010

1111
main :: IO ()
1212
main = do
13-
hSetBuffering stdout LineBuffering
13+
-- Disable output buffering
14+
hSetBuffering stdout NoBuffering
15+
hSetBuffering stderr NoBuffering
1416

1517
- -- You can use print statements as follows for debugging, they'll be visible when running tests.
1618
- BC.putStrLn "Logs from your program will appear here"

starter_templates/haskell/code/app/Main.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ module Main (main) where
55
import Control.Monad (forever)
66
import qualified Data.ByteString.Char8 as BC
77
import Network.Socket
8-
import System.IO (BufferMode (..), hSetBuffering, stdout)
8+
import System.IO (BufferMode (NoBuffering), hSetBuffering, stdout, stderr)
99

1010
main :: IO ()
1111
main = do
12-
hSetBuffering stdout LineBuffering
12+
-- Disable output buffering
13+
hSetBuffering stdout NoBuffering
14+
hSetBuffering stderr NoBuffering
1315

1416
-- You can use print statements as follows for debugging, they'll be visible when running tests.
1517
BC.putStrLn "Logs from your program will appear here"

0 commit comments

Comments
 (0)