Create a partially applied record constructor
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 25/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 領域
- backend
研究方向
The issue describes a proposed partially applied record constructor and shows an existing applyFields implementation using Prim.Row and Record.disjointUnion. Start by reading the package’s current record construction APIs and the linked example; determine whether <*> can support field-based application while preserving the intended type constraints. Done means a documented API and tests demonstrate constructing a record without relying on field order.
由索引模型根據 Issue 內容生成。
描述
Consider this:
F <$> x <*> y <*> z
This has a problem traditionally that you need to make sure you get the x/y/z order correct. If you're making forms (web forms) with e.g. a formlet library, this becomes pretty hard to manage.
What if we could do this?
partially F <$> pure {x:a} <*> pure {y:b} <*> pure {z:a}
(or alternatively by using SProxy :: SProxy "a", etc.)
So that partially F would produce a function of one argument of one of the x, y or z fields (or more, I guess). When provided with one, it accepts another argument until all fields have been consumed.
I made special version of <*> that achieves something similar:
module Record.Apply where
import Control.Applicative
import Prim.Row (class Nub, class Union)
import Record (disjointUnion)
-- API
applyFields
:: forall f inner outer combined.
Union inner outer combined
=> Nub combined combined
=> Apply f
=> f { | inner }
-> f { | outer }
-> f { | combined }
applyFields getInner getOuter =
disjointUnion <$> getInner <*> getOuter
infixl 5 applyFields as <|*>
-- Demo
newtype Foo = Foo { x :: Int, y :: String, z :: Array Int }
demo :: forall f. Applicative f => f Foo
demo = Foo <$> pure {y: ""} <|*> pure {x: 2} <|*> pure {z: []}
Which works nicely, but I think re-using <*> would be cool too. Any ideas?
- 主要語言
- PureScript
- 星號
- 68
- 分支
- 33
- 平均合併
- 2 天 23 小時
- 30 天內合併 PR
- 1
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
purescript/purescript-record 的其他 Issue
-
Thoughts on replacing Proxy with VTA?可能已有人在做 @pete-murphy 於 1043 天前認領。 未關閉
難度 5/5 一週以上 新手友好度 10/100
purescript/purescript-record#85 · 3 則留言 · 2 個 reaction ·
-
難度 2/5 1-3 小時 新手友好度 35/100
purescript/purescript-record#84 · 5 則留言 · 1 個 reaction ·
-
status: needs more info
難度 4/5 3-5 天 新手友好度 25/100
purescript/purescript-record#41 · 2 則留言 · 1 個 reaction ·
-
pick function未關閉purs-0.15 type: breaking change
難度 4/5 3-5 天 新手友好度 20/100
purescript/purescript-record#5 · 6 則留言 ·
查看 purescript/purescript-record 的全部 Issue
相似的 Issue
-
ManageSieve proxy: a backend's NO/BYE greeting is skipped as a capability line and reported as EOF未關閉bug
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
Mend: dependency security vulnerability
難度 2/5 1-3 小時 新手友好度 62/100
ManageIQ/manageiq-pods#1476 ·
維護者通常 1 天內回覆
-
mcp: typed tool handlers lose wrapped JSON-RPC errors可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 2/5 1-3 小時 新手友好度 85/100
modelcontextprotocol/go-sdk#1529 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
FinanceFlash/unvibecode#818 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100