Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,265
    • Issues 5,265
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 569
    • Merge requests 569
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13549
Closed
Open
Issue created Apr 08, 2017 by Ryan Scott@RyanGlScottMaintainer

GHC 8.2.1's typechecker rejects code generated by singletons that 8.0 accepts

I recently attempted to upgrade singletons to use GHC 8.2.1, but was thwarted when GHC's typechecker rejected code that was generated by Template Haskell. I was able to put all of this code in a single module (which I've attached), but sadly, it's 1367 lines long. What's important is that GHC 8.0.1 and 8.0.2 accept this code, but neither 8.2.1-rc1 nor HEAD do. Here is the error message you get, in its full glory:

$ /opt/ghc/8.2.1/bin/ghci Bug.hs -fprint-explicit-kinds
GHCi, version 8.2.0.20170403: http://www.haskell.org/ghc/  :? for help                    
Loaded GHCi configuration from /home/rgscott/.ghci                                        
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )                               
                                                                                          
Bug.hs:1328:59: error:                                                                    
    • Couldn't match type ‘c69895866216793215480’ with ‘[a_a337f]’                        
        ‘c69895866216793215480’ is untouchable                                            
          inside the constraints: (arg_a33hh ~ xs_a33fp, arg_a33hi ~ r_a33fq)             
          bound by the type signature for:                                                
                     lambda_a33iH :: forall (xs_a33fp :: [a_a337f]) (r_a33fq :: [[a_a337f]]).
                                     (arg_a33hh ~ xs_a33fp, arg_a33hi ~ r_a33fq) =>       
                                     Sing [a_a337f] xs_a33fp                              
                                     -> Sing [[a_a337f]] r_a33fq                          
                                     -> Sing                                              
                                          [[a_a337f]]
                                          (Apply
                                             [[a_a337f]]
                                             [[a_a337f]]
                                             (Apply
                                                [a_a337f]
                                                (TyFun [[a_a337f]] [[a_a337f]] -> *)
                                                (Let6989586621679736980InterleaveSym4
                                                   [a_a337f]
                                                   [a_a337f]
                                                   a_a337f
                                                   xs0_a33a0
                                                   t_a33aL
                                                   ts_a33aM
                                                   is_a33aO)
                                                arg_a33hh)
                                             arg_a33hi)
          at Bug.hs:(1289,35)-(1294,157)
      Expected type: Sing (TyFun [a_a337f] [a_a337f] -> *) t
                     -> Sing [a_a337f] t1
                     -> Sing [[a_a337f]] t2
                     -> Sing
                          ([a_a337f], [[a_a337f]])
                          ((@@)
                             [[a_a337f]]
                             ([a_a337f], [[a_a337f]])
                             ((@@)
                                [a_a337f]
                                ([[a_a337f]] ~> ([a_a337f], [[a_a337f]]))
                                ((@@)
                                   (TyFun [a_a337f] [a_a337f] -> *)
                                   ([a_a337f] ~> ([[a_a337f]] ~> ([a_a337f], [[a_a337f]])))
                                   (Let6989586621679736980Interleave'Sym4
                                      [a_a337f]
                                      [a_a337f]
                                      a_a337f
                                      [a_a337f]
                                      xs0_a33a0
                                      t_a33aL
                                      ts_a33aM
                                      is_a33aO)
                                   t)
                                t1)
                             t2)
        Actual type: Sing (TyFun [a_a337f] c69895866216793215480 -> *) t
                     -> Sing [a_a337f] t1
                     -> Sing [c69895866216793215480] t2
                     -> Sing
                          ([a_a337f], [c69895866216793215480])
                          (Apply
                             [c69895866216793215480]
                             ([a_a337f], [c69895866216793215480])
                             (Apply
                                [a_a337f]
                                ([c69895866216793215480] ~> ([a_a337f], [c69895866216793215480]))
                                (Apply
                                   (TyFun [a_a337f] c69895866216793215480 -> *)
                                   ([a_a337f]
                                    ~> ([c69895866216793215480]
                                        ~> ([a_a337f], [c69895866216793215480])))
                                   (Let6989586621679736980Interleave'Sym4
                                      [a_a337f]
                                      [a_a337f]
                                      a_a337f
                                      c69895866216793215480
                                      xs0_a33a0
                                      t_a33aL
                                      ts_a33aM
                                      is_a33aO)
                                   t)
                                t1)
                             t2)
    • In the second argument of ‘singFun3’, namely ‘sInterleave'’
      In the first argument of ‘applySing’, namely
        ‘((singFun3
             (Proxy ::
                Proxy (Let6989586621679736980Interleave'Sym4 xs0_a33a0 t_a33aL ts_a33aM is_a33aO)))
            sInterleave')’
      In the first argument of ‘applySing’, namely
        ‘((applySing
             ((singFun3
                 (Proxy ::
                    Proxy (Let6989586621679736980Interleave'Sym4 xs0_a33a0 t_a33aL ts_a33aM is_a33aO)))
                sInterleave'))
            ((singFun1 (Proxy :: Proxy IdSym0)) sId))’
    • Relevant bindings include
        sX_6989586621679737266 :: Sing
                                    ([a_a337f], [[a_a337f]])
                                    (Let6989586621679737265X_6989586621679737266Sym6
                                       [a_a337f]
                                       [a_a337f]
                                       a_a337f
                                       xs0_a33a0
                                       t_a33aL
                                       ts_a33aM
                                       is_a33aO
                                       xs_a33fp
                                       r_a33fq)
          (bound at Bug.hs:1321:41)
        r_a33iK :: Sing [[a_a337f]] r_a33fq (bound at Bug.hs:1295:57)
        xs_a33iJ :: Sing [a_a337f] xs_a33fp (bound at Bug.hs:1295:48)
        lambda_a33iH :: Sing [a_a337f] xs_a33fp
                        -> Sing [[a_a337f]] r_a33fq
                        -> Sing
                             [[a_a337f]]
                             (Apply
                                [[a_a337f]]
                                [[a_a337f]]
                                (Apply
                                   [a_a337f]
                                   (TyFun [[a_a337f]] [[a_a337f]] -> *)
                                   (Let6989586621679736980InterleaveSym4
                                      [a_a337f]
                                      [a_a337f]
                                      a_a337f
                                      xs0_a33a0
                                      t_a33aL
                                      ts_a33aM
                                      is_a33aO)
                                   arg_a33hh)
                                arg_a33hi)
          (bound at Bug.hs:1295:35)
        sR :: Sing [[a_a337f]] arg_a33hi (bound at Bug.hs:1287:45)
        sXs :: Sing [a_a337f] arg_a33hh (bound at Bug.hs:1287:41)
        sInterleave' :: forall (arg_a33he :: TyFun
                                               [a_a337f] c69895866216793215480
                                             -> *) (arg_a33hf :: [a_a337f]) (arg_a33hg :: [c69895866216793215480]).
                        Sing (TyFun [a_a337f] c69895866216793215480 -> *) arg_a33he
                        -> Sing [a_a337f] arg_a33hf
                        -> Sing [c69895866216793215480] arg_a33hg
                        -> Sing
                             ([a_a337f], [c69895866216793215480])
                             (Apply
                                [c69895866216793215480]
                                ([a_a337f], [c69895866216793215480])
                                (Apply
                                   [a_a337f]
                                   ([c69895866216793215480] ~> ([a_a337f], [c69895866216793215480]))
                                   (Apply
                                      (TyFun [a_a337f] c69895866216793215480 -> *)
                                      ([a_a337f]
                                       ~> ([c69895866216793215480]
                                           ~> ([a_a337f], [c69895866216793215480])))
                                      (Let6989586621679736980Interleave'Sym4
                                         [a_a337f]
                                         [a_a337f]
                                         a_a337f
                                         c69895866216793215480
                                         xs0_a33a0
                                         t_a33aL
                                         ts_a33aM
                                         is_a33aO)
                                      arg_a33he)
                                   arg_a33hf)
                                arg_a33hg)
          (bound at Bug.hs:1166:29)
        lambda_a33ha :: Sing a_a337f t_a33aL
                        -> Sing [a_a337f] ts_a33aM
                        -> Sing [a_a337f] is_a33aO
                        -> Sing
                             [[a_a337f]]
                             (Apply
                                [a_a337f]
                                [[a_a337f]]
                                (Apply
                                   [a_a337f]
                                   ([a_a337f] ~> [[a_a337f]])
                                   (Let6989586621679736931PermsSym1 a_a337f xs0_a33a0)
                                   arg_a33h0)
                                arg_a33h1)
          (bound at Bug.hs:1153:23)
        sTs :: Sing [a_a337f] n_a1kQd (bound at Bug.hs:1143:34)
        sT :: Sing a_a337f n_a1kQc (bound at Bug.hs:1143:31)
        lambda_a33gY :: Sing [a_a337f] xs0_a33a0
                        -> Sing
                             [[a_a337f]]
                             (Apply [a_a337f] [[a_a337f]] (PermutationsSym0 a_a337f) t_a33gX)
          (bound at Bug.hs:1127:11)
        (Some bindings suppressed; use -fmax-relevant-binds=N or -fno-max-relevant-binds)
     |
1328 |                                                           sInterleave'))
     |                                                           ^^^^^^^^^^^^

Bug.hs:1328:59: error:
    • Could not deduce: (Let6989586621679736980Interleave'
                           [a_a337f]
                           [a_a337f]
                           a_a337f
                           c69895866216793215480
                           xs0_a33a0
                           t_a33aL
                           ts_a33aM
                           is_a33aO
                           t
                           t1
                           t2 :: ([a_a337f], [c69895866216793215480]))
                        ~~
                        (Let6989586621679736980Interleave'
                           [a_a337f]
                           [a_a337f]
                           a_a337f
                           [a_a337f]
                           xs0_a33a0
                           t_a33aL
                           ts_a33aM
                           is_a33aO
                           t
                           t1
                           t2 :: ([a_a337f], [c69895866216793215480]))
      from the context: t_a33gX ~ xs0_a33a0
        bound by the type signature for:
                   lambda_a33gY :: forall (xs0_a33a0 :: [a_a337f]).
                                   t_a33gX ~ xs0_a33a0 =>
                                   Sing [a_a337f] xs0_a33a0
                                   -> Sing
                                        [[a_a337f]]
                                        (Apply
                                           [a_a337f] [[a_a337f]] (PermutationsSym0 a_a337f) t_a33gX)
        at Bug.hs:(1122,11)-(1126,67)
      or from: arg_a33h0 ~ (':) a_a337f n_a1kQc n_a1kQd
        bound by a pattern with constructor:
                   SCons :: forall a_11 (z_a1kQb :: [a_11]) (n_a1kQc :: a_11) (n_a1kQd :: [a_11]).
                            z_a1kQb ~ (':) a_11 n_a1kQc n_a1kQd =>
                            Sing a_11 n_a1kQc -> Sing [a_11] n_a1kQd -> Sing [a_11] z_a1kQb,
                 in an equation for ‘sPerms’
        at Bug.hs:1143:25-36
      or from: (arg_a33h0
                ~
                Apply
                  [a_a337f]
                  [a_a337f]
                  (Apply
                     a_a337f (TyFun [a_a337f] [a_a337f] -> *) ((:$) a_a337f) t_a33aL)
                  ts_a33aM,
                arg_a33h1 ~ is_a33aO)
        bound by the type signature for:
                   lambda_a33ha :: forall (t_a33aL :: a_a337f) (ts_a33aM :: [a_a337f]) (is_a33aO :: [a_a337f]).
                                   (arg_a33h0
                                    ~
                                    Apply
                                      [a_a337f]
                                      [a_a337f]
                                      (Apply
                                         a_a337f
                                         (TyFun [a_a337f] [a_a337f] -> *)
                                         ((:$) a_a337f)
                                         t_a33aL)
                                      ts_a33aM,
                                    arg_a33h1 ~ is_a33aO) =>
                                   Sing a_a337f t_a33aL
                                   -> Sing [a_a337f] ts_a33aM
                                   -> Sing [a_a337f] is_a33aO
                                   -> Sing
                                        [[a_a337f]]
                                        (Apply
                                           [a_a337f]
                                           [[a_a337f]]
                                           (Apply
                                              [a_a337f]
                                              ([a_a337f] ~> [[a_a337f]])
                                              (Let6989586621679736931PermsSym1 a_a337f xs0_a33a0)
                                              arg_a33h0)
                                           arg_a33h1)
        at Bug.hs:(1145,23)-(1152,117)
      or from: (arg_a33hh ~ xs_a33fp, arg_a33hi ~ r_a33fq)
        bound by the type signature for:
                   lambda_a33iH :: forall (xs_a33fp :: [a_a337f]) (r_a33fq :: [[a_a337f]]).
                                   (arg_a33hh ~ xs_a33fp, arg_a33hi ~ r_a33fq) =>
                                   Sing [a_a337f] xs_a33fp
                                   -> Sing [[a_a337f]] r_a33fq
                                   -> Sing
                                        [[a_a337f]]
                                        (Apply
                                           [[a_a337f]]
                                           [[a_a337f]]
                                           (Apply
                                              [a_a337f]
                                              (TyFun [[a_a337f]] [[a_a337f]] -> *)
                                              (Let6989586621679736980InterleaveSym4
                                                 [a_a337f]
                                                 [a_a337f]
                                                 a_a337f
                                                 xs0_a33a0
                                                 t_a33aL
                                                 ts_a33aM
                                                 is_a33aO)
                                              arg_a33hh)
                                           arg_a33hi)
        at Bug.hs:(1289,35)-(1294,157)
      Expected type: Sing (TyFun [a_a337f] [a_a337f] -> *) t
                     -> Sing [a_a337f] t1
                     -> Sing [[a_a337f]] t2
                     -> Sing
                          ([a_a337f], [[a_a337f]])
                          ((@@)
                             [[a_a337f]]
                             ([a_a337f], [[a_a337f]])
                             ((@@)
                                [a_a337f]
                                ([[a_a337f]] ~> ([a_a337f], [[a_a337f]]))
                                ((@@)
                                   (TyFun [a_a337f] [a_a337f] -> *)
                                   ([a_a337f] ~> ([[a_a337f]] ~> ([a_a337f], [[a_a337f]])))
                                   (Let6989586621679736980Interleave'Sym4
                                      [a_a337f]
                                      [a_a337f]
                                      a_a337f
                                      [a_a337f]
                                      xs0_a33a0
                                      t_a33aL
                                      ts_a33aM
                                      is_a33aO)
                                   t)
                                t1)
                             t2)
        Actual type: Sing (TyFun [a_a337f] c69895866216793215480 -> *) t
                     -> Sing [a_a337f] t1
                     -> Sing [c69895866216793215480] t2
                     -> Sing
                          ([a_a337f], [c69895866216793215480])
                          (Apply
                             [c69895866216793215480]
                             ([a_a337f], [c69895866216793215480])
                             (Apply
                                [a_a337f]
                                ([c69895866216793215480] ~> ([a_a337f], [c69895866216793215480]))
                                (Apply
                                   (TyFun [a_a337f] c69895866216793215480 -> *)
                                   ([a_a337f]
                                    ~> ([c69895866216793215480]
                                        ~> ([a_a337f], [c69895866216793215480])))
                                   (Let6989586621679736980Interleave'Sym4
                                      [a_a337f]
                                      [a_a337f]
                                      a_a337f
                                      c69895866216793215480
                                      xs0_a33a0
                                      t_a33aL
                                      ts_a33aM
                                      is_a33aO)
                                   t)
                                t1)
                             t2)
      The type variable ‘c69895866216793215480’ is ambiguous
    • In the second argument of ‘singFun3’, namely ‘sInterleave'’
      In the first argument of ‘applySing’, namely
        ‘((singFun3
             (Proxy ::
                Proxy (Let6989586621679736980Interleave'Sym4 xs0_a33a0 t_a33aL ts_a33aM is_a33aO)))
            sInterleave')’
      In the first argument of ‘applySing’, namely
        ‘((applySing
             ((singFun3
                 (Proxy ::
                    Proxy (Let6989586621679736980Interleave'Sym4 xs0_a33a0 t_a33aL ts_a33aM is_a33aO)))
                sInterleave'))
            ((singFun1 (Proxy :: Proxy IdSym0)) sId))’
    • Relevant bindings include
        sX_6989586621679737266 :: Sing
                                    ([a_a337f], [[a_a337f]])
                                    (Let6989586621679737265X_6989586621679737266Sym6
                                       [a_a337f]
                                       [a_a337f]
                                       a_a337f
                                       xs0_a33a0
                                       t_a33aL
                                       ts_a33aM
                                       is_a33aO
                                       xs_a33fp
                                       r_a33fq)
          (bound at Bug.hs:1321:41)
        r_a33iK :: Sing [[a_a337f]] r_a33fq (bound at Bug.hs:1295:57)
        xs_a33iJ :: Sing [a_a337f] xs_a33fp (bound at Bug.hs:1295:48)
        lambda_a33iH :: Sing [a_a337f] xs_a33fp
                        -> Sing [[a_a337f]] r_a33fq
                        -> Sing
                             [[a_a337f]]
                             (Apply
                                [[a_a337f]]
                                [[a_a337f]]
                                (Apply
                                   [a_a337f]
                                   (TyFun [[a_a337f]] [[a_a337f]] -> *)
                                   (Let6989586621679736980InterleaveSym4
                                      [a_a337f]
                                      [a_a337f]
                                      a_a337f
                                      xs0_a33a0
                                      t_a33aL
                                      ts_a33aM
                                      is_a33aO)
                                   arg_a33hh)
                                arg_a33hi)
          (bound at Bug.hs:1295:35)
        sR :: Sing [[a_a337f]] arg_a33hi (bound at Bug.hs:1287:45)
        sXs :: Sing [a_a337f] arg_a33hh (bound at Bug.hs:1287:41)
        sInterleave' :: forall (arg_a33he :: TyFun
                                               [a_a337f] c69895866216793215480
                                             -> *) (arg_a33hf :: [a_a337f]) (arg_a33hg :: [c69895866216793215480]).
                        Sing (TyFun [a_a337f] c69895866216793215480 -> *) arg_a33he
                        -> Sing [a_a337f] arg_a33hf
                        -> Sing [c69895866216793215480] arg_a33hg
                        -> Sing
                             ([a_a337f], [c69895866216793215480])
                             (Apply
                                [c69895866216793215480]
                                ([a_a337f], [c69895866216793215480])
                                (Apply
                                   [a_a337f]
                                   ([c69895866216793215480] ~> ([a_a337f], [c69895866216793215480]))
                                   (Apply
                                      (TyFun [a_a337f] c69895866216793215480 -> *)
                                      ([a_a337f]
                                       ~> ([c69895866216793215480]
                                           ~> ([a_a337f], [c69895866216793215480])))
                                      (Let6989586621679736980Interleave'Sym4
                                         [a_a337f]
                                         [a_a337f]
                                         a_a337f
                                         c69895866216793215480
                                         xs0_a33a0
                                         t_a33aL
                                         ts_a33aM
                                         is_a33aO)
                                      arg_a33he)
                                   arg_a33hf)
                                arg_a33hg)
          (bound at Bug.hs:1166:29)
        lambda_a33ha :: Sing a_a337f t_a33aL
                        -> Sing [a_a337f] ts_a33aM
                        -> Sing [a_a337f] is_a33aO
                        -> Sing
                             [[a_a337f]]
                             (Apply
                                [a_a337f]
                                [[a_a337f]]
                                (Apply
                                   [a_a337f]
                                   ([a_a337f] ~> [[a_a337f]])
                                   (Let6989586621679736931PermsSym1 a_a337f xs0_a33a0)
                                   arg_a33h0)
                                arg_a33h1)
          (bound at Bug.hs:1153:23)
        sTs :: Sing [a_a337f] n_a1kQd (bound at Bug.hs:1143:34)
        sT :: Sing a_a337f n_a1kQc (bound at Bug.hs:1143:31)
        lambda_a33gY :: Sing [a_a337f] xs0_a33a0
                        -> Sing
                             [[a_a337f]]
                             (Apply [a_a337f] [[a_a337f]] (PermutationsSym0 a_a337f) t_a33gX)
          (bound at Bug.hs:1127:11)
        (Some bindings suppressed; use -fmax-relevant-binds=N or -fno-max-relevant-binds)
     |
1328 |                                                           sInterleave'))
     |                                                           ^^^^^^^^^^^^
Edited Mar 10, 2019 by Ryan Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking