Skip to content

Singling Nat-indexed GADT with addition? #580

@bgamari

Description

@bgamari

The following genSingletons application fails:

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}

module Main where

import GHC.TypeLits
import Data.Kind
import Data.Singletons.TH
import Data.Singletons.TH.Options

type RegLayout :: Nat -> Type
data RegLayout len where
    Both  :: forall len1 len2. RegLayout len1 -> RegLayout len2 -> RegLayout (len1 + len2)

$(withOptions (defaultOptions {genSingKindInsts=False}) $ genSingletons [ ''RegLayout ])

The problem appears to be the application of the (+) type family in the result type of Both. I suppose such family usage is just expecting too much of poor singletons?

  • singletons-th-3.1
  • singletons-3.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions