LanguageExt
C# Functional Programming Language Extensions
截圖 共 2 張
模組介紹 作者原文
C# Functional Programming Language Extensions
=============================================
This library uses and abuses the features of C# to provide a functional-programming 'base class library' that, if you squint, can look like
extensions to the language itself. The desire here is to make programming in C# much more reliable and to make the engineer's inertia flow
in the direction of declarative and functional code rather than imperative.
__Author on...__
- __twitter:__ @paullouth
- __mastodon:__ @louthy@4four.org
__Paul Louth discussing FP for the GitHub ReadME project__
Contents
- Reference
- Nu-get package
- Code-gen setup
- Unity
- Getting started
- Prologue
- Features
- Functional effects and IO
- Atomic concurrency, shared state, and collections
- Immutable collections
- Optional and Alternative value monads
- State managing monads
- Parser combinators
- Type aliasing
- Records, Unions, Free Monads, Lenses - Code Generation
- Pretty: Produce nicely formatted text with smart layouts
- Make C# better: memoisation, currying, partial application, Nullable, Task, and IQueryable extensions
- Poor tuple support
- Null reference problem
- Option
- Lack of lambda and expression inference
- Void isn't a real type
- Mutable lists and dictionaries
- Lists
- List pattern matching
- Maps
- Difficulty in creating immutable record types
- Transformation of immutable types
- [[With]](#with)
- Transformation of nested immutable types with Lenses
- [[WithLens]](#withlens)
- The awful 'out' parameter
- The lack of ad-hoc polymorphism
- Num
- Eq
- Ord
- Semigroup
- Monoid
- Monad
- Transformer types
- Contributing & Code of Conduct
Reference
- API Reference
- Issues that contain documentation and examples
Nu-get
Nu-get package | Description
---------------|-------------
LanguageExt.Core | All of the core types and functional 'prelude'. __This is all that's needed to get started__.
LanguageExt.Transformers | For every combination of monadic type M> (i.e. Seq>), this package provides the following extension methods: ApplyT, AppendT, BindT, CompareT, CountT, EqualsT, ExistsT, ForAllT, FoldT, FoldBackT, FilterT, IterT, MapT, PlusT, ProductT, SubtractT, DivideT, and SumT. Which makes it much easier to work with those nested types (no need to manually unpack the bound values)
LanguageExt.FSharp | F# to C# interop package. Provides interop between the LanguageExt.Core types (like Option, List and Map) to the F# equivalents, as well as interop between core BCL types and F#
LanguageExt.Parsec | Port of the Haskell parsec library
LanguageExt.Rx | Reactive Extensions support for various types within the Core
LanguageExt.Sys | Provides an Aff and Eff wrapper around the.NET System namespace making common IO operations pure and unit-testable
LanguageExt.SysX | As above, but provides.NET5+ specific features
LanguageExt.CodeGen | Used to generate records, unions, lenses, and With functions automagically.
Code-gen setup
To use the code-generation features of language-ext (which are totally optional by the way), then you must include the LanguageExt.CodeGen package into your project.
To make the reference build and design time only (i.e. your project doesn't gain an additional dependencies because of the code-generator), open up your csproj and set the PrivateAssets attribute to all:
Obviously, update the Version attributes to the appropriate values. Also note that you will probably need the latest VS2019+ for this to work. Even early versions of VS2019 seem to have problems.
There's more information on the code-gen features on the wiki
Unity
This library seems compatible on the latest (at the time of writing) Unity 2018.2 with __incremental compiler__ (which enables C# 7), so it should work well once Unity has official support for C# 7 on upcoming 2018.3.
In the meanwhile, you can install incremental compiler instead.
If you are concerned about writing functionally and the possible performance overheads then p
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。