Was ist der Unterschied, wenn ich das schreibe? data Book = Book Int Int gegen newtype Book = Book (Int, Int) -- "Book Int Int" is syntactically invalid
Ich versuche, meinen eigenen Datentyp zu erstellen, der Teil der Monad-Klasse sein wird, aber newtype Container a = Container a deriving Monad gibt mir diesen Fehler: * Can't make a derived instance of `Monad Container' (even with cunning GeneralizedNewtypeDeriving): cannot eta-reduce the representation type enough * In the newtype declaration …
Ich habe ein Dutzend solcher Newtypes: newtype MyBool = MyBool Bool newtype MyInt = MyInt Int Ich möchte vorhandene Instanzen wiederverwenden: instance MArray IOUArray Int IO where ... instance MArray (STUArray s) Int (ST s) where ... Das Implementieren dieser Instanzen und des gesamten Boilerplate-Codes ist das Letzte, was ich …
We use cookies and other tracking technologies to improve your browsing experience on our website,
to show you personalized content and targeted ads, to analyze our website traffic,
and to understand where our visitors are coming from.
By continuing, you consent to our use of cookies and other tracking technologies and
affirm you're at least 16 years old or have consent from a parent or guardian.