{"id":27645024,"url":"https://github.com/zhaskell/stdio","last_synced_at":"2025-12-11T23:15:54.241Z","repository":{"id":56879095,"uuid":"132269638","full_name":"ZHaskell/stdio","owner":"ZHaskell","description":"Haskell Standard Input and Output","archived":false,"fork":false,"pushed_at":"2020-10-24T16:34:37.000Z","size":3473,"stargazers_count":104,"open_issues_count":6,"forks_count":5,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-24T00:59:32.613Z","etag":null,"topics":["haskell","haskell-stdio","libuv"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZHaskell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-05T17:25:06.000Z","updated_at":"2024-11-15T23:57:33.000Z","dependencies_parsed_at":"2022-08-20T23:10:54.331Z","dependency_job_id":null,"html_url":"https://github.com/ZHaskell/stdio","commit_stats":null,"previous_names":["haskell-stdio/stdio"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZHaskell%2Fstdio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZHaskell%2Fstdio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZHaskell%2Fstdio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZHaskell%2Fstdio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZHaskell","download_url":"https://codeload.github.com/ZHaskell/stdio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250540983,"owners_count":21447427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","haskell-stdio","libuv"],"created_at":"2025-04-24T00:59:36.813Z","updated_at":"2025-12-11T23:15:54.195Z","avatar_url":"https://github.com/ZHaskell.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Haskell stdio: haskell standard input and output\n================================================\n\n**This project is moved to [project Z](https://github.com/haskell-Z/Z) and split into several packages**.\n\n[![Linux Build Status](https://img.shields.io/travis/haskell-stdio/stdio/master.svg?label=Linux%20build)](https://travis-ci.org/haskell-stdio/stdio)\n[![Windows Build Status](https://img.shields.io/appveyor/ci/winterland1989/stdio-7usux/master.svg?label=Windows%20build)](https://ci.appveyor.com/project/winterland1989/stdio-7usux/branch/master)\n\nWelcome! Haskell stdio is a complete I/O toolkit powered by libuv, it features a multi-core io multiplexer and various improvements on packed data types. This project is still in infancy. Please join in!\n\n```\n    __  _____   _____ __ __ ________    __       _______________  ________ \n   / / / /   | / ___// //_// ____/ /   / /      / ___/_  __/ __ \\/  _/ __ \\\n  / /_/ / /| | \\__ \\/ ,\u003c  / __/ / /   / /       \\__ \\ / / / / / // // / / /\n / __  / ___ |___/ / /| |/ /___/ /___/ /___    ___/ // / / /_/ // // /_/ / \n/_/ /_/_/  |_/____/_/ |_/_____/_____/_____/   /____//_/ /_____/___/\\____/\n```\n\nInstall\n-------\n\nOn windows we have bundled libuv source, so no extra steps to be taken.\n\nOn \\*nix platforms, you should install libuv library first, you can use your distribution's package manager if available, for example:\n\n```\n# on debian/ubuntu, make sure to use 1.x\napt-get install libuv1-dev  libuv1\n\n# on MacOS, we recommend brew\nbrew install libuv\n\n...\n```\n\nCurrently **the minimum version requirement for libuv is v1.14**. If your package manager's libuv doesn't meet this requirement, you can also build libuv from source following the guide [here](https://github.com/libuv/libuv#build-instructions), e.g.\n\n```\ngit clone https://github.com/libuv/libuv.git \ncd libuv \ngit checkout tags/v1.24.0   # depend on your own need, any version \u003e= 1.14 will work.\nsh autogen.sh \n./configure \nmake \nsudo make install \n```\n\nAfter manually building and installing, you may need to modify your `LIBRARY_PATH/CPATH` if necessary. Now installing stdio is as easy as any other haskell packages.  \n\n```\ncabal install stdio\n```\n\nNow you can fire GHCi and play around, or read the [project overview](https://haskell-stdio.github.io/stdio), [haddock](http://hackage.haskell.org/package/stdio).\n\nExamples\n--------\n\n+ hello world\n\n```\nimport Std.IO.StdStream\nimport qualified Std.Data.Text as T\n\nmain = do\n    -- read stdin and write to stdout, but with our new IO manager!\n    input \u003c- readLineStd\n    printStd (T.validate input)\n```\n\n+ tcp echo server\n\n```\nimport Std.IO.TCP\nimport Std.IO.Buffered\nimport Control.Monad\n\nmain = do\n    startServer defaultServerConfig\n        { serverAddr = SockAddrInet 8888 inetAny\n        , serverWorker = echo\n        }\n  where\n    echo uvs = forever $ do\n        i \u003c- newBufferedInput uvs 4096\n        o \u003c- newBufferedOutput uvs 4096\n        readBuffer i \u003e\u003e= writeBuffer o\n        flushBuffer o\n```\n\nNow try `nc -v 127.0.0.1 8888`.\n\n+ logging\n\n```\nimport Std.IO.Logger\nimport qualified Std.Data.Builder as B\nimport Control.Concurrent\n\nmain = withStdLogger $ do\n    debug $ \"hello world! PI ~=\" \u003e\u003e B.double pi     -- debug level won't be immediately flushed\n    forkIO $ do\n        fatal \"fatal message will trigger a log flush\"\n```\n\n+ file system operatations\n\n```\nimport           Std.IO.FileSystem\nimport           Std.IO.Resource\nimport           Std.IO.StdStream\n\nmain = do\n    -- create a temp directory\n    tempdir \u003c- mkdtemp \"temp\"   \n    let filename = \"temp\" \u003c\u003e \"/test\"\n        flags = O_RDWR .|. O_CREAT      -- create if not exist\n        mode = DEFAULT_MODE\n\n    -- file is a 'Resource', use 'withResource' to automatically manage it\n    withResource (initUVFile filename flags mode) $ \\ f -\u003e do\n        o \u003c- newBufferedOutput file 4096\n        writeBuffer o \"hello world!\"\n        flushBuffer o\n\n    stat filename \u003e\u003e= printStd\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaskell%2Fstdio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhaskell%2Fstdio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaskell%2Fstdio/lists"}