Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Expose every Function of a wrapped type (Leonhard Applis) ---------------------------------------------------------------------- Message: 1 Date: Fri, 15 Nov 2019 11:36:03 +0000 From: Leonhard Applis <leonhard.app...@protonmail.com> To: "beginners@haskell.org" <beginners@haskell.org> Subject: [Haskell-beginners] Expose every Function of a wrapped type Message-ID: <8VyrlRTZwYrqqkI95kJ3UHQ41YSXFwhcqA4orOfVyau1ULCyCnVVkPI__Ya6rLaYFCUrVB3yM0IqT_l5NcCiMHhyfjsRg0S2xmxG3Cmvkq0=@protonmail.com> Content-Type: text/plain; charset="utf-8" Hi, I currently have a newtype definition of a typed Data.Map. newtype G = G Data.Map String Values I have done this because for my specific use-case, I can define G as a monoid and get some nice benefits. However, I find myself often just re-declaring functions of Data.Map and wrap/unwrap them in my Constructor G, such as singleton :: String -> Value -> G singleton s v = G $ (Data.Map.singleton s v) I think I do not need to limit the scope of G's functionality, I basically want everything from Data.Map + Bonus , like my Monoid. Also I want G to be a specific Data.Map, there is never any other case where it's not a Map String Values. However, if I have type G2 = Data.Map String Values I cannot instance Monoid. So, I am very sure that I'm not the first person ever doing this. Is there a language extension providing what I want? Or is what i want "bad"? Am I just missing a higher-order base function which does what I want? best regards & thanks Leonhard -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20191115/904e640f/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: publickey - leonhard.app...@protonmail.com - 0x807FDDF3.asc Type: application/pgp-keys Size: 1843 bytes Desc: not available URL: <http://mail.haskell.org/pipermail/beginners/attachments/20191115/904e640f/attachment-0001.key> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 477 bytes Desc: OpenPGP digital signature URL: <http://mail.haskell.org/pipermail/beginners/attachments/20191115/904e640f/attachment-0001.sig> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 137, Issue 2 *****************************************