typed-process 项目教程
typed-process Alternative API for processes, featuring more type safety 项目地址:https://gitcode.com/gh_mirrors/ty/typed-process
1. 项目的目录结构及介绍
typed-process/
├── CHANGELOG.md
├── LICENSE
├── README.md
├── Setup.hs
├── app/
│ └── Main.hs
├── src/
│ ├── System/
│ │ ├── Process/
│ │ │ ├── Typed.hs
│ │ │ ├── Internal.hs
│ │ │ └── Types.hs
│ │ └── Process.hs
│ └── Paths_typed_process.hs
├── test/
│ └── Spec.hs
├── typed-process.cabal
└── stack.yaml
目录结构介绍
CHANGELOG.md : 记录项目的变更历史。LICENSE : 项目的许可证信息。README.md : 项目的介绍和使用说明。Setup.hs : 用于构建项目的脚本。app/ : 包含项目的可执行文件。
src/ : 包含项目的源代码。
System/Process/Typed.hs : 主要的功能实现文件。System/Process/Internal.hs : 内部实现文件。System/Process/Types.hs : 类型定义文件。System/Process.hs : 其他相关处理文件。Paths_typed_process.hs : 自动生成的路径配置文件。 test/ : 包含项目的测试代码。
typed-process.cabal : 项目的配置文件。stack.yaml : 用于 Stack 构建工具的配置文件。
2. 项目的启动文件介绍
app/Main.hs
module Main where
import System.Process.Typed
main :: IO ()
main = do
process <- startProcess (proc "echo" ["Hello, World!"])
exitCode <- waitExitCode process
print exitCode
启动文件介绍
Main.hs : 这是项目的启动文件,包含了主函数 main
。在这个文件中,我们使用 System.Process.Typed
模块来启动一个外部进程,并等待其完成。
3. 项目的配置文件介绍
typed-process.cabal
name: typed-process
version: 0.2.12.0
synopsis: Run external processes with strong typing of streams
description: Please see the tutorial at <https://github.com/fpco/typed-process#readme>
homepage: https://github.com/fpco/typed-process
license: MIT
author: Michael Snoyman <michael@snoyman.com>, Tom Sydney Kerckhove <syd@cs-syd.eu>
maintainer: Michael Snoyman <michael@snoyman.com>, Tom Sydney Kerckhove <syd@cs-syd.eu>
category: System
build-type: Simple
extra-source-files: CHANGELOG.md
cabal-version: >=1.10
executable typed-process
main-is: Main.hs
other-modules: Paths_typed_process
build-depends: base >=4.10 && <5
, typed-process
hs-source-dirs: app
default-language: Haskell2010
library
exposed-modules: System.Process.Typed
, System.Process.Typed.Internal
, System.Process.Typed.Types
other-modules: Paths_typed_process
build-depends: base >=4.10 && <5
, async
, bytestring
, process
, stm
hs-source-dirs: src
default-language: Haskell2010
test-suite typed-process-test
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules: Paths_typed_process
build-depends: base >=4.10 && <5
, typed-process
, hspec
hs-source-dirs: test
default-language: Haskell2010
配置文件介绍
typed-process Alternative API for processes, featuring more type safety 项目地址:https://gitcode.com/gh_mirrors/ty/typed-process