Re: [GHC] #7459: deriving Generic does not work with TypeLits
#7459: deriving Generic does not work with TypeLits -+-- Reporter: maxtaldykin | Owner: dreixel Type: feature request | Status: new Priority: normal| Milestone: Component: Compiler | Version: 7.6.1 Keywords:| Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Other Difficulty: Unknown |Testcase: Blockedby:|Blocking: Related:| -+-- Comment(by simonpj@…): commit 61f770f6df66e75c8920c17840670bea971062bf {{{ Author: Simon Peyton Jones simo...@microsoft.com Date: Sat Dec 1 18:29:21 2012 + isTauTy should be True for LitTy (see Trac #7459) compiler/typecheck/TcType.lhs |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7459#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #7459: deriving Generic does not work with TypeLits
#7459: deriving Generic does not work with TypeLits -+-- Reporter: maxtaldykin | Owner: dreixel Type: feature request | Status: new Priority: normal| Milestone: Component: Compiler | Version: 7.6.1 Keywords:| Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Other Difficulty: Unknown |Testcase: Blockedby:|Blocking: Related:| -+-- Changes (by simonpj): * difficulty: = Unknown Comment: I don't know abou the generic part, but it's certainly the case that `isTauTy` should return `True` for `LitTy`. I'll change that, but meanwhile I'll leave this ticket open because it's not clear what the behaviour of generics should be on `LitTy`. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7459#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #7459: deriving Generic does not work with TypeLits
#7459: deriving Generic does not work with TypeLits -+-- Reporter: maxtaldykin | Owner: dreixel Type: feature request | Status: new Priority: normal| Component: Compiler Version: 7.6.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Other | Blockedby: Blocking:|Related: -+-- Changes (by dreixel): * owner: = dreixel * failure: GHC rejects valid program = Other * type: bug = feature request Comment: Thanks for the report, although I don't think this is a bug. We have not intended `Generic` to be used with `TypeLits` (or any `DataKinds` stuff); the error message is not entirely accurate, but that's not what you are reporting. Changing `isTauTy` might have deep implications throughout the compiler; I don't think that's the right fix here. I would be more inclined to change `bad_arg_type` in `TcGenGenerics`. But first we should think exactly of what generic programming with arguments of kind `Symbol` implies. Can you tell me what kind of generic functionality you want on datatypes such as `F` and `X`? Just some example values and the functions you would want to use on them would be clarifying. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7459#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #7459: deriving Generic does not work with TypeLits
#7459: deriving Generic does not work with TypeLits --+- Reporter: maxtaldykin| Owner: Type: bug| Status: new Priority: normal | Component: Compiler Version: 7.6.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: GHC rejects valid program | Blockedby: Blocking: |Related: --+- {{{ {-# LANGUAGE DataKinds, KindSignatures #-} {-# LANGUAGE DeriveGeneric #-} import GHC.TypeLits import GHC.Generics data F (a :: Symbol) data X = X (F hello) deriving Generic }}} Trying to derive Generics instance for simple datatype with Symbol inside but GHC complains: {{{ Can't make a derived instance of `Generic X': X must not have unlifted or polymorphic arguments In the data declaration for `X' }}} I found that this could be fixed by adding single line to isTauTy: {{{ --- a/compiler/typecheck/TcType.lhs +++ b/compiler/typecheck/TcType.lhs @@ -899,6 +899,7 @@ mkTcEqPred ty1 ty2 isTauTy :: Type - Bool isTauTy ty | Just ty' - tcView ty = isTauTy ty' isTauTy (TyVarTy _) = True +isTauTy (LitTy _)= True isTauTy (TyConApp tc tys) = all isTauTy tys isTauTyCon tc isTauTy (AppTy a b) = isTauTy a isTauTy b isTauTy (FunTy a b) = isTauTy a isTauTy b }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7459 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs