Commit abd66223 authored by Vladislav Zavialov's avatar Vladislav Zavialov Committed by Ben Gamari
Browse files

Do not imply NoStarIsType by TypeOperators/TypeInType

Implementation of the "Embrace TypeInType" proposal was done according
to the spec, which specified that TypeOperators must imply NoStarIsType.
This implication was meant to prevent breakage and to be removed in 2
releases.  However, compiling head.hackage has shown that this
implication only magnified the breakage, so there is no reason to have
it in the first place.

To remain in compliance with the three-release policy, we add a
workaround to define the (*) type operator even when -XStarIsType is on.

Test Plan: ./validate

Reviewers: bgamari, RyanGlScott, goldfire, phadej, hvr

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4865
parent 0c701b69
......@@ -1311,14 +1311,10 @@ pprLoc (UnhelpfulSpan {}) = empty
-- coming from GHC.TypeNats). In this case the user will get a kind
-- mismatch error. This is a violation of assumption (c).
--
-- Since NoStarIsType is implied by a fairly common extension TypeOperators,
-- the user might be working on a module with NoStarIsType unbeknownst to him.
-- Even if the user switched off StarIsType manually, he might have forgotten
-- about it and use '*' as 'Data.Kind.Type' out of habit.
--
-- Thus it is very important to give a hint whenever an assumption about '*' is
-- violated. Unfortunately, it is somewhat difficult to deal with (c), so we
-- limit ourselves to (a) and (b).
-- The user might unknowingly be working on a module with NoStarIsType
-- or use '*' as 'Data.Kind.Type' out of habit. So it is important to give a
-- hint whenever an assumption about '*' is violated. Unfortunately, it is
-- somewhat difficult to deal with (c), so we limit ourselves to (a) and (b).
--
-- 'starInfo' generates an appropriate hint to the user depending on the
-- extensions enabled in the module and the name that triggered the error.
......@@ -1326,10 +1322,10 @@ pprLoc (UnhelpfulSpan {}) = empty
-- Unicode variant, the resulting SDoc will contain a helpful suggestion.
-- Otherwise it is empty.
--
starInfo :: (Bool, Bool) -> RdrName -> SDoc
starInfo (type_operators, star_is_type) rdr_name =
starInfo :: Bool -> RdrName -> SDoc
starInfo star_is_type rdr_name =
-- One might ask: if can use sdocWithDynFlags here, why bother to take
-- (type_operators, star_is_type) as input? Why not refactor?
-- star_is_type as input? Why not refactor?
--
-- The reason is that sdocWithDynFlags would provide DynFlags that are active
-- in the module that tries to load the problematic definition, not
......@@ -1340,10 +1336,7 @@ starInfo (type_operators, star_is_type) rdr_name =
-- with StarIsType enabled!
--
if isUnqualStar && not star_is_type
then text "With NoStarIsType" <>
(if type_operators
then text " (implied by TypeOperators), "
else text ", ") <>
then text "With NoStarIsType, " <>
quotes (ppr rdr_name) <>
text " is treated as a regular type operator. "
$$
......
......@@ -814,6 +814,7 @@ data WarningFlag =
| Opt_WarnMissingExportList
| Opt_WarnInaccessibleCode
| Opt_WarnStarIsType -- Since 8.6
| Opt_WarnStarBinder -- Since 8.6
| Opt_WarnImplicitKindVars -- Since 8.6
deriving (Eq, Show, Enum)
......@@ -3859,6 +3860,7 @@ wWarningFlagsDeps = [
flagSpec "simplifiable-class-constraints" Opt_WarnSimplifiableClassConstraints,
flagSpec "missing-home-modules" Opt_WarnMissingHomeModules,
flagSpec "unrecognised-warning-flags" Opt_WarnUnrecognisedWarningFlags,
flagSpec "star-binder" Opt_WarnStarBinder,
flagSpec "star-is-type" Opt_WarnStarIsType,
flagSpec "partial-fields" Opt_WarnPartialFields ]
......@@ -4362,7 +4364,6 @@ impliedXFlags
, (LangExt.TypeInType, turnOn, LangExt.DataKinds)
, (LangExt.TypeInType, turnOn, LangExt.PolyKinds)
, (LangExt.TypeInType, turnOn, LangExt.KindSignatures)
, (LangExt.TypeInType, turnOff, LangExt.StarIsType)
-- AutoDeriveTypeable is not very useful without DeriveDataTypeable
, (LangExt.AutoDeriveTypeable, turnOn, LangExt.DeriveDataTypeable)
......@@ -4374,9 +4375,6 @@ impliedXFlags
, (LangExt.ImpredicativeTypes, turnOn, LangExt.RankNTypes)
-- See Note [When is StarIsType enabled]
, (LangExt.TypeOperators, turnOff, LangExt.StarIsType)
-- Record wild-cards implies field disambiguation
-- Otherwise if you write (C {..}) you may well get
-- stuff like " 'a' not in scope ", which is a bit silly
......@@ -4404,12 +4402,10 @@ impliedXFlags
-- programs expect '*' to be synonymous with 'Type', so by default StarIsType is
-- enabled.
--
-- However, programs that use TypeOperators might expect to repurpose '*' for
-- multiplication or another binary operation, so we make TypeOperators imply
-- NoStarIsType.
-- Programs that use TypeOperators might expect to repurpose '*' for
-- multiplication or another binary operation, but making TypeOperators imply
-- NoStarIsType caused too much breakage on Hackage.
--
-- It is still possible to have TypeOperators and StarIsType enabled at the same
-- time, although it's not recommended.
-- Note [Documenting optimisation flags]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -4559,6 +4555,7 @@ standardWarnings -- see Note [Documenting warning flags]
Opt_WarnTabs,
Opt_WarnUnrecognisedWarningFlags,
Opt_WarnSimplifiableClassConstraints,
Opt_WarnStarBinder,
Opt_WarnInaccessibleCode
]
......
......@@ -68,7 +68,6 @@ module Lexer (
explicitNamespacesEnabled,
patternSynonymsEnabled,
sccProfilingOn, hpcEnabled,
typeOperatorsEnabled,
starIsTypeEnabled,
addWarning,
lexTokenStream,
......@@ -2264,7 +2263,6 @@ data ExtBits
| TypeApplicationsBit
| StaticPointersBit
| NumericUnderscoresBit
| TypeOperatorsBit
| StarIsTypeBit
deriving Enum
......@@ -2334,8 +2332,6 @@ staticPointersEnabled :: ExtsBitmap -> Bool
staticPointersEnabled = xtest StaticPointersBit
numericUnderscoresEnabled :: ExtsBitmap -> Bool
numericUnderscoresEnabled = xtest NumericUnderscoresBit
typeOperatorsEnabled :: ExtsBitmap -> Bool
typeOperatorsEnabled = xtest TypeOperatorsBit
starIsTypeEnabled :: ExtsBitmap -> Bool
starIsTypeEnabled = xtest StarIsTypeBit
......@@ -2392,7 +2388,6 @@ mkParserFlags flags =
.|. TypeApplicationsBit `xoptBit` LangExt.TypeApplications
.|. StaticPointersBit `xoptBit` LangExt.StaticPointers
.|. NumericUnderscoresBit `xoptBit` LangExt.NumericUnderscores
.|. TypeOperatorsBit `xoptBit` LangExt.TypeOperators
.|. StarIsTypeBit `xoptBit` LangExt.StarIsType
optBits =
HaddockBit `goptBit` Opt_Haddock
......
......@@ -871,6 +871,12 @@ checkTyClHdr is_cls ty
where
goL (L l ty) acc ann fix = go l ty acc ann fix
-- workaround to define '*' despite StarIsType
go _ (HsParTy _ (L l (HsStarTy _ isUni))) acc ann fix
= do { warnStarBndr l
; let name = mkOccName tcClsName (if isUni then "★" else "*")
; return (L l (Unqual name), acc, fix, ann) }
go l (HsTyVar _ _ (L _ tc)) acc ann fix
| isRdrTc tc = return (L l tc, acc, fix, ann)
go _ (HsOpTy _ t1 ltc@(L _ tc) t2) acc ann _fix
......@@ -1748,11 +1754,19 @@ warnStarIsType span = addWarning Opt_WarnStarIsType span msg
$$ text "Suggested fix: use" <+> quotes (text "Type")
<+> text "from" <+> quotes (text "Data.Kind") <+> text "instead."
warnStarBndr :: SrcSpan -> P ()
warnStarBndr span = addWarning Opt_WarnStarBinder span msg
where
msg = text "Desugaring" <+> quotes (text "*") <+> text "in a binder"
<+> text "position as a type operator despite StarIsType."
$$ text "NB. To use (or export) this operator in"
<+> text "modules with StarIsType,"
$$ text " including the definition module, you must qualify it."
failOpFewArgs :: Located RdrName -> P a
failOpFewArgs (L loc op) =
do { type_operators <- extension typeOperatorsEnabled
; star_is_type <- extension starIsTypeEnabled
; let msg = too_few $$ starInfo (type_operators, star_is_type) op
do { star_is_type <- extension starIsTypeEnabled
; let msg = too_few $$ starInfo star_is_type op
; parseErrorSDoc loc msg }
where
too_few = text "Operator applied to too few arguments:" <+> ppr op
......
......@@ -930,9 +930,8 @@ lookup_demoted rdr_name
| Just demoted_rdr <- demoteRdrName rdr_name
-- Maybe it's the name of a *data* constructor
= do { data_kinds <- xoptM LangExt.DataKinds
; type_operators <- xoptM LangExt.TypeOperators
; star_is_type <- xoptM LangExt.StarIsType
; let star_info = starInfo (type_operators, star_is_type) rdr_name
; let star_info = starInfo star_is_type rdr_name
; if data_kinds
then do { mb_demoted_name <- lookupOccRn_maybe demoted_rdr
; case mb_demoted_name of
......
......@@ -51,8 +51,7 @@ Language
- A new :extension:`StarIsType` language extension has been added which controls
whether ``*`` is parsed as ``Data.Kind.Type`` or a regular type operator.
:extension:`StarIsType` is enabled by default and disabled by
:extension:`TypeOperators`.
:extension:`StarIsType` is enabled by default.
- GHC now permits the use of a wildcard type as the context of a standalone
``deriving`` declaration with the use of the
......
......@@ -8678,8 +8678,7 @@ Kind polymorphism
.. extension:: TypeInType
:shortdesc: Deprecated. Enable kind polymorphism and datatype promotion.
 
:implies: :extension:`PolyKinds`, :extension:`DataKinds`, :extension:`KindSignatures`,
:extension:`NoStarIsType`
:implies: :extension:`PolyKinds`, :extension:`DataKinds`, :extension:`KindSignatures`
:since: 8.0.1
 
In the past this extension used to enable advanced type-level programming
......@@ -9131,8 +9130,7 @@ The kind ``Type``
:since: 8.6.1
 
Treat the unqualified uses of the ``*`` type operator as nullary and desugar
to ``Data.Kind.Type``. Disabled by :extension:`TypeOperators` and
:extension:`TypeInType`.
to ``Data.Kind.Type``.
 
The kind ``Type`` (imported from ``Data.Kind``) classifies ordinary types. With
:extension:`StarIsType` (currently enabled by default), ``*`` is desugared to
......
......@@ -3,6 +3,7 @@
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
......
Foo :: forall k -> k -> Type
Foo :: forall k -> k -> *
T15039b.hs:19:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’
standing for ‘Dict ((a :: Type) ~ (b :: Type))’
• Found type wildcard ‘_’ standing for ‘Dict ((a :: *) ~ (b :: *))’
Where: ‘a’, ‘b’ are rigid type variables bound by
the type signature for:
ex1 :: forall a b. Dict ((a :: Type) ~ (b :: Type)) -> ()
ex1 :: forall a b. Dict ((a :: *) ~ (b :: *)) -> ()
at T15039b.hs:18:1-45
• In a pattern type signature: _
In the pattern: Dict :: _
In an equation for ‘ex1’: ex1 (Dict :: _) = ()
• Relevant bindings include
ex1 :: Dict ((a :: Type) ~ (b :: Type)) -> ()
(bound at T15039b.hs:19:1)
ex1 :: Dict ((a :: *) ~ (b :: *)) -> () (bound at T15039b.hs:19:1)
T15039b.hs:22:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’
standing for ‘Dict ((a :: Type) ~ (b :: Type))’
• Found type wildcard ‘_’ standing for ‘Dict ((a :: *) ~ (b :: *))’
Where: ‘a’, ‘b’ are rigid type variables bound by
the type signature for:
ex2 :: forall a b. Dict ((a :: Type) ~ (b :: Type)) -> ()
ex2 :: forall a b. Dict ((a :: *) ~ (b :: *)) -> ()
at T15039b.hs:21:1-46
• In a pattern type signature: _
In the pattern: Dict :: _
In an equation for ‘ex2’: ex2 (Dict :: _) = ()
• Relevant bindings include
ex2 :: Dict ((a :: Type) ~ (b :: Type)) -> ()
(bound at T15039b.hs:22:1)
ex2 :: Dict ((a :: *) ~ (b :: *)) -> () (bound at T15039b.hs:22:1)
T15039b.hs:25:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’
standing for ‘Dict ((a :: Type) ~~ (b :: k))’
standing for ‘Dict ((a :: *) ~~ (b :: k))’
Where: ‘a’, ‘b’, ‘k’ are rigid type variables bound by
the type signature for:
ex3 :: forall k a (b :: k). Dict ((a :: Type) ~~ (b :: k)) -> ()
ex3 :: forall k a (b :: k). Dict ((a :: *) ~~ (b :: k)) -> ()
at T15039b.hs:24:1-43
• In a pattern type signature: _
In the pattern: Dict :: _
In an equation for ‘ex3’: ex3 (Dict :: _) = ()
• Relevant bindings include
ex3 :: Dict ((a :: Type) ~~ (b :: k)) -> ()
(bound at T15039b.hs:25:1)
ex3 :: Dict ((a :: *) ~~ (b :: k)) -> () (bound at T15039b.hs:25:1)
T15039b.hs:33:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘Dict (Coercible Type a b)’
• Found type wildcard ‘_’ standing for ‘Dict (Coercible * a b)’
Where: ‘a’, ‘b’ are rigid type variables bound by
the type signature for:
ex6 :: forall a b. Dict (Coercible Type a b) -> ()
ex6 :: forall a b. Dict (Coercible * a b) -> ()
at T15039b.hs:32:1-53
• In a pattern type signature: _
In the pattern: Dict :: _
In an equation for ‘ex6’: ex6 (Dict :: _) = ()
• Relevant bindings include
ex6 :: Dict (Coercible Type a b) -> () (bound at T15039b.hs:33:1)
ex6 :: Dict (Coercible * a b) -> () (bound at T15039b.hs:33:1)
T15039b.hs:35:8: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘Coercible Type a b’
• Found type wildcard ‘_’ standing for ‘Coercible * a b’
Where: ‘a’, ‘b’ are rigid type variables bound by
the inferred type of ex7 :: Coercible Type a b => Coercion Type a b
the inferred type of ex7 :: Coercible * a b => Coercion * a b
at T15039b.hs:36:1-14
• In the type signature:
ex7 :: _ => Coercion (a :: Type) (b :: Type)
T15039d.hs:19:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’
standing for ‘Dict ((a :: Type) ~ (b :: Type))’
• Found type wildcard ‘_’ standing for ‘Dict ((a :: *) ~ (b :: *))’
Where: ‘a’, ‘b’ are rigid type variables bound by
the type signature for:
ex1 :: forall a b. Dict ((a :: Type) ~ (b :: Type)) -> ()
ex1 :: forall a b. Dict ((a :: *) ~ (b :: *)) -> ()
at T15039d.hs:18:1-45
• In a pattern type signature: _
In the pattern: Dict :: _
In an equation for ‘ex1’: ex1 (Dict :: _) = ()
• Relevant bindings include
ex1 :: Dict ((a :: Type) ~ (b :: Type)) -> ()
(bound at T15039d.hs:19:1)
ex1 :: Dict ((a :: *) ~ (b :: *)) -> () (bound at T15039d.hs:19:1)
T15039d.hs:22:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’
standing for ‘Dict ((a :: Type) ~~ (b :: Type))’
standing for ‘Dict ((a :: *) ~~ (b :: *))’
Where: ‘a’, ‘b’ are rigid type variables bound by
the type signature for:
ex2 :: forall a b. Dict ((a :: Type) ~~ (b :: Type)) -> ()
ex2 :: forall a b. Dict ((a :: *) ~~ (b :: *)) -> ()
at T15039d.hs:21:1-46
• In a pattern type signature: _
In the pattern: Dict :: _
In an equation for ‘ex2’: ex2 (Dict :: _) = ()
• Relevant bindings include
ex2 :: Dict ((a :: Type) ~~ (b :: Type)) -> ()
(bound at T15039d.hs:22:1)
ex2 :: Dict ((a :: *) ~~ (b :: *)) -> () (bound at T15039d.hs:22:1)
T15039d.hs:25:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’
standing for ‘Dict ((a :: Type) ~~ (b :: k))’
standing for ‘Dict ((a :: *) ~~ (b :: k))’
Where: ‘a’, ‘b’, ‘k’ are rigid type variables bound by
the type signature for:
ex3 :: forall k a (b :: k). Dict ((a :: Type) ~~ (b :: k)) -> ()
ex3 :: forall k a (b :: k). Dict ((a :: *) ~~ (b :: k)) -> ()
at T15039d.hs:24:1-43
• In a pattern type signature: _
In the pattern: Dict :: _
In an equation for ‘ex3’: ex3 (Dict :: _) = ()
• Relevant bindings include
ex3 :: Dict ((a :: Type) ~~ (b :: k)) -> ()
(bound at T15039d.hs:25:1)
ex3 :: Dict ((a :: *) ~~ (b :: k)) -> () (bound at T15039d.hs:25:1)
T15039d.hs:33:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘Dict (Coercible Type a b)’
• Found type wildcard ‘_’ standing for ‘Dict (Coercible * a b)’
Where: ‘a’, ‘b’ are rigid type variables bound by
the type signature for:
ex6 :: forall a b. Dict (Coercible Type a b) -> ()
ex6 :: forall a b. Dict (Coercible * a b) -> ()
at T15039d.hs:32:1-53
• In a pattern type signature: _
In the pattern: Dict :: _
In an equation for ‘ex6’: ex6 (Dict :: _) = ()
• Relevant bindings include
ex6 :: Dict (Coercible Type a b) -> () (bound at T15039d.hs:33:1)
ex6 :: Dict (Coercible * a b) -> () (bound at T15039d.hs:33:1)
T15039d.hs:35:8: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’
standing for ‘(a :: Type) ~R# (b :: Type)’
• Found type wildcard ‘_’ standing for ‘(a :: *) ~R# (b :: *)’
Where: ‘a’, ‘b’ are rigid type variables bound by
the inferred type of
ex7 :: ((a :: Type) ~R# (b :: Type)) => Coercion Type a b
ex7 :: ((a :: *) ~R# (b :: *)) => Coercion * a b
at T15039d.hs:36:1-14
• In the type signature:
ex7 :: _ => Coercion (a :: Type) (b :: Type)
......@@ -11,7 +11,7 @@ T14584.hs:56:41: warning: [-Wdeferred-type-errors (in -Wdefault)]
act @_ @_ @act (fromSing @m (sing @m @a :: Sing _))
T14584.hs:56:50: warning: [-Wdeferred-type-errors (in -Wdefault)]
• Expected kind ‘m1’, but ‘a’ has kind ‘Type
• Expected kind ‘m1’, but ‘a’ has kind ‘*
• In the type ‘a’
In the second argument of ‘fromSing’, namely
‘(sing @m @a :: Sing _)’
......
......@@ -3,7 +3,7 @@
module T10134 where
import GHC.TypeLits
import GHC.TypeLits as L
import T10134a
import Prelude
......@@ -11,9 +11,9 @@ type Positive n = ((n-1)+1)~n
data Dummy n d = Dummy { vec :: Vec n (Vec d Bool) }
nextDummy :: Positive (2*(n+d)) => Dummy n d -> Dummy n d
nextDummy :: Positive (2 L.* (n+d)) => Dummy n d -> Dummy n d
nextDummy d = Dummy { vec = vec dFst }
where (dFst,dSnd) = nextDummy' d
nextDummy' :: Positive (2*(n+d)) => Dummy n d -> ( Dummy n d, Bool )
nextDummy' :: Positive (2 L.* (n+d)) => Dummy n d -> ( Dummy n d, Bool )
nextDummy' _ = undefined
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE QuasiQuotes #-}
module Main where
......
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE NoStarIsType #-}
module TH_unresolvedInfix_Lib where
......
{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-}
module TcTypeNatSimple where
import GHC.TypeLits
import GHC.TypeLits as L
import Data.Proxy
--------------------------------------------------------------------------------
......@@ -8,7 +8,7 @@ import Data.Proxy
e1 :: Proxy (2 + 3) -> Proxy 5
e1 = id
e2 :: Proxy (2 * 3) -> Proxy 6
e2 :: Proxy (2 L.* 3) -> Proxy 6
e2 = id
e3 :: Proxy (2 ^ 3) -> Proxy 8
......@@ -20,16 +20,16 @@ e4 = id
e5 :: Proxy (x + 0) -> Proxy x
e5 = id
e6 :: Proxy (x * 0) -> Proxy 0
e6 :: Proxy (x L.* 0) -> Proxy 0
e6 = id
e7 :: Proxy (0 * x) -> Proxy 0
e7 :: Proxy (0 L.* x) -> Proxy 0
e7 = id
e8 :: Proxy (x * 1) -> Proxy x
e8 :: Proxy (x L.* 1) -> Proxy x
e8 = id
e9 :: Proxy (1 * x) -> Proxy x
e9 :: Proxy (1 L.* x) -> Proxy x
e9 = id
e10 :: Proxy (x ^ 1) -> Proxy x
......@@ -83,10 +83,10 @@ e23 = id
ti2 :: Proxy (y + x) -> Proxy x -> ()
ti2 _ _ = ()
ti3 :: Proxy (2 * y) -> ()
ti3 :: Proxy (2 L.* y) -> ()
ti3 _ = ()
ti4 :: Proxy (y * 2) -> ()
ti4 :: Proxy (y L.* 2) -> ()
ti4 _ = ()
ti5 :: Proxy (2 ^ y) -> ()
......
......@@ -2,7 +2,7 @@
UndecidableInstances, ConstraintKinds #-}
module TypeInTypeSubstitutions where
import GHC.TypeLits
import GHC.TypeLits as L
import Data.Type.Bool
import Data.Type.Equality
import Data.List (sort)
......@@ -21,7 +21,7 @@ type One = NLogN 0 0
type O (a :: AsympPoly) = a
type family (^.) (n :: AsympPoly) (m :: Nat) :: AsympPoly where
(NLogN a b) ^. n = (NLogN (a * n) (b * n))
(NLogN a b) ^. n = (NLogN (a L.* n) (b L.* n))
type family (*.) (n :: AsympPoly) (m :: AsympPoly) :: AsympPoly where
(NLogN a b) *. (NLogN c d) = NLogN (a+c) (b+d)
......
{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-}
module Main(main) where
import GHC.TypeLits
import GHC.TypeLits as L
import Data.Proxy
--------------------------------------------------------------------------------
......@@ -12,10 +12,10 @@ tsub _ _ = Proxy
tsub2 :: Proxy (x + y) -> (Proxy x, Proxy y)
tsub2 _ = (Proxy, Proxy)
tdiv :: Proxy (x * y) -> Proxy y -> Proxy x
tdiv :: Proxy (x L.* y) -> Proxy y -> Proxy x
tdiv _ _ = Proxy
tdiv2 :: Proxy (x * y) -> (Proxy x, Proxy y)
tdiv2 :: Proxy (x L.* y) -> (Proxy x, Proxy y)
tdiv2 _ = (Proxy, Proxy)
troot :: Proxy (x ^ y) -> Proxy y -> Proxy x
......
{-# LANGUAGE TypeOperators, TypeFamilies #-}
module X (type (X.*)) where
type family (*) a b where { (*) a b = Either b a }
StarBinder.hs:5:14: warning: [-Wstar-binder (in -Wdefault)]
Desugaring ‘*’ in a binder position as a type operator despite StarIsType.
NB. To use (or export) this operator in modules with StarIsType,
including the definition module, you must qualify it.
StarBinder.hs:5:30: warning: [-Wstar-binder (in -Wdefault)]
Desugaring ‘*’ in a binder position as a type operator despite StarIsType.
NB. To use (or export) this operator in modules with StarIsType,
including the definition module, you must qualify it.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment