我試圖從使用符號的函數返回一個Maybe值,但我似乎無法讓它工作。這個函數的字符串(「文件名」),並在搜索路徑... findIn :: String -> Path -> Maybe Path
findIn search start = do
file <- ls start
if ((filename file) == search)
then Just fi
如果我有一個祖父母,一個孩子的成分和一個孫子成分,祖父母可以請求孩子的狀態嗎?我試過使用「請求」,如here,但是當你請求一個也有自己孩子的孩子的狀態時,類型不匹配。當我請求沒有孩子的孩子的狀態時,指南中的示例正常工作。 的錯誤是: Could not match type
Query
with type
Coproduct (Coproduct Query (Chil
我試圖訪問嵌套數據(Foo.y內Bar在下面的示例中),但解開Foo內部Bar想到的直接方法不起作用。但如何正確解開它? 這裏我的數據: module Foo where
import Prelude
data Foo = Foo { y :: Int }
data Bar = Bar { x :: Int
, foo :: Foo }
下(當然)無法編譯,錯誤是C
比方說,我有一個接口A: interface A {
foo: number
bar: string
}
而且我有一個泛型類型Option: type Option<T> = {
map:() => T
}
然後我從A和Option創建一個新的接口B: interface B {
foo: Option<number>
bar: Opt
我正在通過Prompt及其Bind實例中描述的here的定義工作,並試圖弄清楚Purescript會如何顯示。 我正在使用Purescript.Exists作爲存在類型。我確定指標則是: data PromptAskF p r a
= PromptAskF (p a) (a -> Prompt p r)
type PromptAsk p r = Exists (PromptAskF