Ich bin neu in Haskell, also vermisse ich wahrscheinlich etwas Offensichtliches, aber was scheint hier das Problem zu sein?Singletons TypRepStar Sing Data Instanz
Die Singleton-Bibliothek bietet eine Instanz für die Art *
in import Data.Singletons.TypeRepStar
.
Die Sing
Daten Familie ist wie folgt definiert ..
data family Sing (a :: k)
und die *
Instanz ist wie folgt definiert ..
data instance Sing (a :: *) where
STypeRep :: Typeable a => Sing a
Ich versuche, eine Minimalversion von dieser mit der zu reproduzieren folgende ...
{-# LANGUAGE GADTs
, TypeFamilies
, PolyKinds
#-}
module Main where
import Data.Typeable
data family Bloop (a :: k)
data instance Bloop (a :: *) where
Blop :: Typeable a => Bloop a
main :: IO()
main = putStrLn "Hello, Haskell!"
Aber ich bekomme die f Fehler ach ...
Main.hs:12:3: error:
• Data constructor ‘Blop’ returns type ‘Bloop a’
instead of an instance of its parent type ‘Bloop a’
• In the definition of data constructor ‘Blop’
In the data instance declaration for ‘Bloop’
|
12 | Blop :: Typeable a => Bloop a
| ^
hätte nie gedacht, ich sehen würde: "Ich bin ein Anfänger Haskell" und Singletons in der gleichen Post –
@JustinL. Ich habe eine Menge Metaprogrammiererfahrung von C++, deshalb ist es für mich nicht so gruselig: D – pat