我學習耶索德,並尋找在ghci中PostgreSQL的使用例子,當我遇到了這個 How to perform database queries in GHCi in Yesod Application pcon <- openSimpleConn con
軟件包已經改變,因爲這個答案給出,現在openSimpleConn需要LogFunc除了連接字符串。閱讀文檔的openSimpleConn和
下面的代碼段已被寫入ghci type GNum = TVar Int
-- updateNum will read a num and add the given value to it
updateNum :: GNum -> Int -> STM()
updateNum n v =
do t <- readTVar n
writeTVar n (v + t)
--
的派生實例,我使用ghci,該代碼段 newtype Gold = Gold Int
deriving (Eq, Ord, Show, Num)
顯示錯誤的 Can't make a derived instance of 'Num Gold':
'Num' is not a derivable class
Try GeneralizedNewTypeDerivi
賦予了許多類型類的約束: {-# LANGUAGE ConstraintKinds, MultiParamTypeClasses #-}
import Data.Array.Unboxed(Ix,IArray,UArray)
type IntLike a = (Ord a, Num a, Enum a, Show a, Ix a, IArray UArray a)
我如何可以找出哪些類型