[GHC] #11349: [TypeApplications] Create Proxy-free alternatives of functions in base
GHC
ghc-devs at haskell.org
Mon Jan 4 19:29:22 UTC 2016
#11349: [TypeApplications] Create Proxy-free alternatives of functions in base
----------------------------------------+---------------------------------
Reporter: Iceland_jack | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Core Libraries | Version: 7.10.3
Keywords: TypeApplications | Operating System: Other
Architecture: Unknown/Multiple | Type of failure: None/Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
----------------------------------------+---------------------------------
Now that we have [https://phabricator.haskell.org/D1138 TypeApplications]
how about we create a Proxy-free version of functions in base that
currently require it:
{{{#!hs
tr :: forall a. Typeable a => TypeRep
tr = typeRep @Proxy @a Proxy
symbol :: forall s. KnownSymbol s => String
symbol = symbolVal @s Proxy
nat :: forall n. KnownNat n => Integer
nat = natVal @n Proxy
}}}
While we're at it let's use [https://hackage.haskell.org/package/base/docs
/Numeric-Natural.html Natural] as the value-level representation of Nat,
avoiding `Maybe` in `someNatVal :: Integer -> Maybe SomeNat`:
{{{#!hs
nat :: forall n. KnownNat n => Natural
nat = natVal @n Proxy
someNatVal :: Natural -> SomeNat
someNatVal = ...
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11349>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list