mtl-style-example 项目教程

随笔14小时前发布 文中莲花
2 0 0

mtl-style-example 项目教程

mtl-style-exampleA small example of using mtl style to unit test effectful code项目地址:https://gitcode.com/gh_mirrors/mt/mtl-style-example

1. 项目的目录结构及介绍




mtl-style-example/


├── package.yaml


├── README.md


├── stack.yaml


├── library/


│   └── ...


├── executables/


│   └── Main.hs


└── test-suite/


    └── Main.hs

package.yaml: 项目的配置文件,定义了项目的元数据、依赖和构建选项。README.md: 项目的说明文档。stack.yaml: 用于 Stack 构建工具的配置文件。library/: 包含项目的核心代码。executables/: 包含可执行文件的源代码,其中 Main.hs 是启动文件。test-suite/: 包含测试代码,其中 Main.hs 是测试启动文件。

2. 项目的启动文件介绍

可执行文件启动文件

位于 executables/Main.hs,是项目的入口点,负责启动应用程序。

测试启动文件

位于 test-suite/Main.hs,是测试套件的入口点,负责运行项目的测试。

3. 项目的配置文件介绍

package.yaml




name: mtl-style-example


version: '0.0.0'


category: Other


synopsis: A small example of using mtl style to unit test effectful code


description: A small example of using mtl style to unit test effectful code


maintainer: Alexis King


extra-source-files:


- package.yaml


- README.md


- stack.yaml


ghc-options: -Wall


default-extensions:


- DefaultSignatures


- GADTs


- GeneralizedNewtypeDeriving


- LambdaCase


- OverloadedStrings


library:


  dependencies:


  - base


  - monad-logger


  - monad-time


  - mtl


  - text


  - time


  - transformers


  source-dirs: library


executables:


  mtl-style-example:


    dependencies:


    - base


    - mtl-style-example


    ghc-options:


    - -rtsopts


    - -threaded


    - -with-rtsopts=-N


    main: Main.hs


    source-dirs: executables

name: 项目名称。version: 项目版本。category: 项目分类。synopsis: 项目简介。description: 项目详细描述。maintainer: 项目维护者。extra-source-files: 额外的源文件。ghc-options: GHC 编译选项。default-extensions: 默认的 Haskell 语言扩展。library: 库部分的依赖和源代码目录。executables: 可执行文件部分的依赖、编译选项和源代码目录。

stack.yaml




resolver: lts-18.18


packages:


- .

resolver: 指定 Stack 使用的 LTS 版本。packages: 指定包含项目的目录。

通过以上内容,您可以了解 mtl-style-example 项目的基本结构和配置。希望这份教程对您有所帮助!

mtl-style-exampleA small example of using mtl style to unit test effectful code项目地址:https://gitcode.com/gh_mirrors/mt/mtl-style-example

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...