

[[_TOC_]]






# GHC 8.6.x Migration Guide







...  ...  @@ 14,40 +16,47 @@ As part of [this GHC proposal](https://github.com/ghcproposals/ghcproposals/bl 





`StarIsType` is enabled by default, and one consequence of this is that GHC will interpret any use of `*` as `Type`, even if it would have been previously interpreted as a binary type operator. A notable example of such a binary type operator is `GHC.TypeLits.*`, so code like:






```



importGHC.TypeLitsf::Proxy m >Proxy n >Proxy(m * n)f__=Proxy



```hs



import GHC.TypeLits






f :: Proxy m > Proxy n > Proxy (m * n)



f _ _ = Proxy



```









Will not typecheck if `StarIsType` is enabled, since `m * n` is treated as if one had written `m Type n`. There are several ways to adapt to this:






1. Use `*` qualified (e.g., `Proxy (m GHC.TypeLits.* n`). This approach is compliant with the GHC threerelease policy, as it does not require CPP to support older GHCs.



1. Enable the `NoStarIsType` extension using a `LANGUAGE` pragma. Since `(No)StarIsType` did not exist on older GHCs, this approach will require CPP in order to support older compilers.



1. Conditionally enable the `NoStarIsType` extension using Cabal's `defaultextensions` field, like this:



2. Enable the `NoStarIsType` extension using a `LANGUAGE` pragma. Since `(No)StarIsType` did not exist on older GHCs, this approach will require CPP in order to support older compilers.



3. Conditionally enable the `NoStarIsType` extension using Cabal's `defaultextensions` field, like this:






```wiki



if impl(ghc >= 8.6)



defaultextensions: NoStarIsType



```



```



if impl(ghc >= 8.6)



defaultextensions: NoStarIsType



```






### `MonadFailDesugaring` by default









GHC now enables the `MonadFailDesugaring` extension by default, as discussed in [https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail\#Transitionalstrategy](https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail#Transitionalstrategy). This means that code that uses partial pattern matches in `do`notation, such as this:






```



f::[[a]]>[a]f l =do(_:xs)< l



```hs



f :: [[a]] > [a]



f l = do



(_:xs) < l



xs



```









Will now desugar to use the `fail` method from the `MonadFail` class instead of from `Monad`. That is, this code will now desugar to something resembling:






```



importControl.Monad.Failas Fail



```hs



import Control.Monad.Fail as Fail






f::[[a]]>[a]f l =case l of(_:xs)> xs



_>Fail.fail "Patternmatch failure"



f :: [[a]] > [a]



f l = case l of



(_:xs) > xs



_ > Fail.fail "Patternmatch failure"



```







...  ...  @@ 63,14 +72,15 @@ Data types with empty `where` clauses (such as `data T where`) are no longer val 





Due to a bug, previous versions of GHC would not emit any `Wincompletepatterns` warnings at all for incomplete patterns inside of guards or `MultiWayIf` expressions. This bug has been fixed, which means that code like:






```



foo::Bool>Intfoo b =if b >1



```hs



foo :: Bool > Int



foo b = if  b > 1



```









Will now raise a warning in GHC 8.6:






```wiki



```



warning: [Wincompletepatterns]



Pattern match(es) are nonexhaustive



In a multiway if alternative:

...  ...  @@ 82,9 +92,9 @@ warning: [Wincompletepatterns] 





GHC is now more diligent about catching illegal uses of kind polymorphism that snuck into recent GHC releases. For instance, this used to be accepted without `PolyKinds`:






```



classC a where



c ::Proxy(x :: a)



```hs



class C a where



c :: Proxy (x :: a)



```







...  ...  @@ 93,9 +103,9 @@ Despite the fact that `a` is used as a kind variable in the type signature for ` 





Moreover, GHC 8.4 would accept the following without the use of `PolyKinds`:






```



f:: forall k (a :: k).Proxy a



f=Proxy



```hs



f :: forall k (a :: k). Proxy a



f = Proxy



```







...  ...  @@ 106,14 +116,25 @@ Despite the fact that `k` is used as both a type and kind variable. This is now 





GHC now requires the `UndecidableInstances` extension in order to allow type family applications in instance contexts, as in the following code:






```



{# LANGUAGE ConstraintKinds #}{# LANGUAGE FlexibleContexts #}{# LANGUAGE FlexibleInstances #}{# LANGUAGE TypeFamilies #}importData.KindtypefamilyF a ::ConstraintclassC a where{



```hs



{# LANGUAGE ConstraintKinds #}



{# LANGUAGE FlexibleContexts #}



{# LANGUAGE FlexibleInstances #}



{# LANGUAGE TypeFamilies #}






import Data.Kind






type family F a :: Constraint



class C a where






{



Will error without UndecidableInstances:






• Illegal nested constraint ‘F a’



(Use UndecidableInstances to permit this)



• In the instance declaration for ‘C [[a]]’



}instanceF a =>C[[a]]



}



instance F a => C [[a]]



```






### DPH is gone

...  ...  