[GHC] #12376: Allow function definitions in record syntax

GHC ghc-devs at haskell.org
Sat Jul 9 00:23:28 UTC 2016


#12376: Allow function definitions in record syntax
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Would it be possible to write

 {{{#!hs
 propertyMap :: (Monad m, Ord k) => v -> PropertyMap m k v
 propertyMap v0 = go v0 Map.empty where
   go v m = PropertyMap
     { getP = \k -> return $ maybe v id (Map.lookup k m)
     , putP = \k v' -> return $ go v (Map.insert k v' m)
     }
 }}}

 as
 {{{#!hs
 propertyMap :: (Monad m, Ord k) => v -> PropertyMap m k v
 propertyMap v0 = go v0 Map.empty where
   go v m = PropertyMap
     { getP k    = return $ maybe v id (Map.lookup k m)
     , putP k v' = return $ go v (Map.insert k v' m)
     }
 }}}

 Simpler example `MkFoo { id = \x -> x }` as

 {{{#!hs
 MkFoo { id x = x }
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12376>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list