我是purescript的新手。這是我正在學習的書Leanpub-purescript。我不明白什麼是翻轉功能。這與交換概念相似嗎? > :type flip
forall a b c. (a -> b -> c) -> b -> a -> c
這意味着a value goes to b, then b to a, then c is itself??。我對此感到震驚。請解釋翻頁概念,如果我
我試圖從Phil Freeman的PureScript書的第6.7節完成練習5。練習要我爲以下類型編寫一個Foldable實例。 data NonEmpty a = NonEmpty a (Array a)
我已經寫了這個實例,通過執行foldMap。 instance foldableNonEmpty :: Foldable a => Foldable NonEmpty where
我試圖基於數據的陣列上創建一個記錄來創建記錄,該功能是這樣的: type Address = {
street :: String,
city :: String,
state :: String
}
convertToAddress :: Array String -> Maybe Address
convertToAddress [street, city
我在閱讀Purescript通過示例並介紹了讀者單元的部分。示例如下: createUser :: Reader Permissions (Maybe User)
createUser = do
permissions <- ask
if hasPermission "admin" permissions
then map Just newUser
els