Pertanyaan tentang topik tersebut 'typeclass'
Kelas tipe Haskell dan keluarga tipe (lanjutan)
Saya butuh bantuan dalam mencari kesalahan kompiler yang benar-benar membuat saya gila...
Saya memiliki kelas tipe berikut:
infixl 7 -->
class Selectable a s b where
type Res a s b :: *
(-->) :: (CNum n) => (Reference s a) ->...
387 dilihat
schedule
23.11.2023
Membuat lensa polimorfik
Saya dapat membuat lensa untuk bidang terakhir ( c ) di tipe data saya dengan melakukan hal berikut:
{-# LANGUAGE DuplicateRecordFields #-}
data X1 a c = X1 { a' :: a, b' :: Int, c' :: c }
data X2 a b c = X2 { a' :: a, b' :: b, c' :: c }
class...
232 dilihat
schedule
27.10.2023
Bagaimana saya bisa membungkus ulang instance kelas tipe
Saya ingin mewakili konsep batas atas dalam kode saya, jadi saya membuat kesatuan yang terdiskriminasi:
data UpperBound a = UpperBound a | DoNotCare deriving (Eq, Read, Show)
Saya kemudian secara manual memperoleh beberapa contoh kelas tipe...
70 dilihat
schedule
19.12.2023