Long story short, this fails (sorry, from the top of my head, might not compile):
{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}
import ProjectM36.Client
import GHC.Generics
import Data.Binary
import Control.DeepSeq
import Data.Proxy
data Typ1 = Typ1 Int
deriving (Generic, Show, Eq, Binary, NFData, Atomable)
data Typ2 = Typ2 Int
deriving (Generic, Show, Eq, Binary, NFData, Atomable)
data Typ3 = Typ31 Typ1 | Typ32 Typ2
deriving (Generic, Show, Eq, Binary, NFData, Atomable)
main :: IO ()
main = print $ toAddTypeExpr (Proxy :: Proxy Typ3)
with a confusing error message of "primitive type missing: Typ1 []" (or something along that lines)
This is happening because it is assumed in the AtomableG (K1 c a) instance that data construction
arguments are primitive, which is not always (or even usually) the case.
Commit a4d9247a2b3392abf28d31a845bb9b2535026f37 fixes this, and I ran some minimal tests, but I'm not sure if there are any unintended side effects. You might want to take a look regardless.
Long story short, this fails (sorry, from the top of my head, might not compile):
with a confusing error message of "primitive type missing: Typ1 []" (or something along that lines)
This is happening because it is assumed in the
AtomableG (K1 c a)
instance that data construction arguments are primitive, which is not always (or even usually) the case.Commit a4d9247a2b3392abf28d31a845bb9b2535026f37 fixes this, and I ran some minimal tests, but I'm not sure if there are any unintended side effects. You might want to take a look regardless.