[GHC] #13865: Add to Data.Proxy a utility function proxy :: a -> Proxy a

#13865: Add to Data.Proxy a utility function proxy :: a -> Proxy a -------------------------------------+------------------------------------- Reporter: louispan | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: 8.2.1 Component: | Version: 8.0.1 libraries/base | Keywords: Proxy | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I sometime find myself wanting to create a Proxy of a certain type (to pass into functions that use Proxy), but I only have easy access to the value, but not the type (eg. because the type is being inferred). That is, I find myself defining the following function proxy :: a -> Proxy a proxy _ = Proxy It would be great if something like that could be added to Data.Proxy -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13865 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13865: Add to Data.Proxy a utility function proxy :: a -> Proxy a -------------------------------------+------------------------------------- Reporter: louispan | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 Component: libraries/base | Version: 8.0.1 Resolution: | Keywords: Proxy Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by louispan: @@ -6,0 +6,1 @@ + {{{#!haskell @@ -8,0 +9,1 @@ + }}} New description: I sometime find myself wanting to create a Proxy of a certain type (to pass into functions that use Proxy), but I only have easy access to the value, but not the type (eg. because the type is being inferred). That is, I find myself defining the following function {{{#!haskell proxy :: a -> Proxy a proxy _ = Proxy }}} It would be great if something like that could be added to Data.Proxy -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13865#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13865: Add to Data.Proxy a utility function proxy :: a -> Proxy a -------------------------------------+------------------------------------- Reporter: louispan | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.2.1 Component: libraries/base | Version: 8.0.1 Resolution: | Keywords: Proxy Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Hi louispan, It's worth noting that `Proxy` is an instance of `Applicative`, so your proposed `proxy` function is simply `pure`. Does that address your needs? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13865#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13865: Add to Data.Proxy a utility function proxy :: a -> Proxy a -------------------------------------+------------------------------------- Reporter: louispan | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: 8.2.1 Component: libraries/base | Version: 8.0.1 Resolution: invalid | Keywords: Proxy Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by louispan): * status: new => closed * resolution: => invalid Comment: Hi RyanGIScott, Oh my gosh, you are right. I never realized I could use (pure @Proxy) instead of that function. Thank you! I'll close this request. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13865#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC