Skip to content

Servant-0.15 fails Core Lint

While reproducing #16918 (closed) with head.hackage I encountered the following, quite different looking, Core Lint failure:

*** Desugar [Servant.Types.SourceT]:
Desugar [Servant.Types.SourceT]: alloc=44631184 time=248.726
*** Simplifier [Servant.Types.SourceT]:
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
    In the expression: (case heq_sel
                               @ (* -> *)
                               @ (* -> *)
                               @ Identity
                               @ Identity
                               ($d~_apms
                                `cast` (((~) <* -> *>_N <Identity>_N (Sym co_arYu))_R ; N:~[0]
                                                                                            <*
                                                                                             -> *>_N <Identity>_N <Identity>_N
                                        :: (Identity ~ m_apmr) ~R# (Identity ~~ Identity)))
                        of co_Xs0P
                        { __DEFAULT ->
                        \ (@ a_apof)
                          (@ b_apog)
                          (f_amLo :: a_apof -> b_apog -> b_apog)
                          (z_amLp :: b_apog)
                          (ds_dsPH :: SourceT Identity a_apof) ->
                          $cfoldr_ariD
                            @ Identity
                            ($d~_apms
                             `cast` (((~) <* -> *>_N <Identity>_N (Sym co_arYu))_R
                                     :: (Identity ~ m_apmr) ~R# (Identity ~ Identity)))
                            @ a_apof
                            @ b_apog
                            f_amLo
                            z_amLp
                            (((ds_dsPH
                               `cast` (N:SourceT[0] <Identity>_N <a_apof>_N
                                       :: SourceT Identity a_apof
                                          ~R# (forall b.
                                               (StepT Identity a_apof -> Identity b)
                                               -> Identity b)))
                                @ (StepT Identity a_apof)
                                ((\ (v_X2u :: StepT Identity a_apof) -> v_X2u)
                                 `cast` (<StepT Identity a_apof>_R
                                         ->_R Sym (N:Identity[0] <StepT Identity a_apof>_R)
                                         :: (StepT Identity a_apof -> StepT Identity a_apof)
                                            ~R# (StepT Identity a_apof
                                                 -> Identity (StepT Identity a_apof)))))
                             `cast` (N:Identity[0] <StepT Identity a_apof>_R
                                     :: Identity (StepT Identity a_apof) ~R# StepT Identity a_apof))
                        })
                         @ a_aps3
                         @ b_asSG
                         c_asSH
                         n_asSI
                         (eta_B1
                          `cast` (Sym (SourceT co_arYu <a_aps3>_N)_R
                                  :: SourceT m_apmr a_aps3 ~R# SourceT Identity a_aps3))
    Type of case alternatives not the same as the annotation on case:
        Actual type: forall a b.
                     (a -> b -> b) -> b -> SourceT Identity a -> b
        Annotation on case: forall a b.
                            (a -> b -> b) -> b -> SourceT m_apmr a -> b
        Alt Rhs: \ (@ a_apof)
                   (@ b_apog)
                   (f_amLo :: a_apof -> b_apog -> b_apog)
                   (z_amLp :: b_apog)
                   (ds_dsPH :: SourceT Identity a_apof) ->
                   $cfoldr_ariD
                     @ Identity
                     ($d~_apms
                      `cast` (((~) <* -> *>_N <Identity>_N (Sym co_arYu))_R
                              :: (Identity ~ m_apmr) ~R# (Identity ~ Identity)))
                     @ a_apof
                     @ b_apog
                     f_amLo
                     z_amLp
                     (((ds_dsPH
                        `cast` (N:SourceT[0] <Identity>_N <a_apof>_N
                                :: SourceT Identity a_apof
                                   ~R# (forall b.
                                        (StepT Identity a_apof -> Identity b) -> Identity b)))
                         @ (StepT Identity a_apof)
                         ((\ (v_X2u :: StepT Identity a_apof) -> v_X2u)
                          `cast` (<StepT Identity a_apof>_R
                                  ->_R Sym (N:Identity[0] <StepT Identity a_apof>_R)
                                  :: (StepT Identity a_apof -> StepT Identity a_apof)
                                     ~R# (StepT Identity a_apof
                                          -> Identity (StepT Identity a_apof)))))
                      `cast` (N:Identity[0] <StepT Identity a_apof>_R
                              :: Identity (StepT Identity a_apof) ~R# StepT Identity a_apof))

I believe the relevant binding is

$ctoList_aprW [InlPrag=INLINE (sat-args=1), Occ=LoopBreaker]
  :: forall (m :: * -> *) a. (Identity ~ m) => SourceT m a -> [a]
[LclId,
 Arity=2,
 Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
         WorkFree=True, Expandable=True,
         Guidance=ALWAYS_IF(arity=2,unsat_ok=False,boring_ok=False)
         Tmpl= \ (@ (m_apmr :: * -> *)) ($d~_apms :: Identity ~ m_apmr) ->
                 case heq_sel
                        @ (* -> *)
                        @ (* -> *)
                        @ Identity
                        @ m_apmr
                        ($d~_apms
                         `cast` (N:~[0] <* -> *>_N <Identity>_N <m_apmr>_N
                                 :: (Identity ~ m_apmr) ~R# (Identity ~~ m_apmr)))
                 of co_arYu
                 { __DEFAULT ->
                 \ (@ a_aps3) (t1_asSF [Occ=Once] :: SourceT m_apmr a_aps3) ->
                   build
                     @ a_aps3
                     (\ (@ b_asSG)
                        (c_asSH [Occ=Once, OS=OneShot] :: a_aps3 -> b_asSG -> b_asSG)
                        (n_asSI [Occ=Once, OS=OneShot] :: b_asSG) ->
                        (case heq_sel
                                @ (* -> *)
                                @ (* -> *)
                                @ Identity
                                @ Identity
                                ($d~_apms
                                 `cast` (((~) <* -> *>_N <Identity>_N (Sym co_arYu))_R ; N:~[0]
                                                                                             <*
                                                                                              -> *>_N <Identity>_N <Identity>_N
                                         :: (Identity ~ m_apmr) ~R# (Identity ~~ Identity)))
                         of co_Xs0R
                         { __DEFAULT ->
                         \ (@ a_apof)
                           (@ b_apog)
                           (f_amLo [Occ=Once, OS=OneShot] :: a_apof -> b_apog -> b_apog)
                           (z_amLp [Occ=Once, OS=OneShot] :: b_apog)
                           (ds_dsPH [Occ=Once, OS=OneShot] :: SourceT Identity a_apof) ->
                           $cfoldr_ariD
                             @ Identity
                             ($d~_apms
                              `cast` (((~) <* -> *>_N <Identity>_N (Sym co_arYu))_R
                                      :: (Identity ~ m_apmr) ~R# (Identity ~ Identity)))
                             @ a_apof
                             @ b_apog
                             f_amLo
                             z_amLp
                             (((ds_dsPH
                                `cast` (N:SourceT[0] <Identity>_N <a_apof>_N
                                        :: SourceT Identity a_apof
                                           ~R# (forall b.
                                                (StepT Identity a_apof -> Identity b)
                                                -> Identity b)))
                                 @ (StepT Identity a_apof)
                                 ((\ (v_B1 [Occ=Once] :: StepT Identity a_apof) -> v_B1)
                                  `cast` (<StepT Identity a_apof>_R
                                          ->_R Sym (N:Identity[0] <StepT Identity a_apof>_R)
                                          :: (StepT Identity a_apof -> StepT Identity a_apof)
                                             ~R# (StepT Identity a_apof
                                                  -> Identity (StepT Identity a_apof)))))
                              `cast` (N:Identity[0] <StepT Identity a_apof>_R
                                      :: Identity (StepT Identity a_apof)
                                         ~R# StepT Identity a_apof))
                         })
                          @ a_aps3
                          @ b_asSG
                          c_asSH
                          n_asSI
                          (t1_asSF
                           `cast` (Sym (SourceT co_arYu <a_aps3>_N)_R
                                   :: SourceT m_apmr a_aps3 ~R# SourceT Identity a_aps3)))
                 }}]
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information