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. How to use Text.Printf w/ custom types (Baa) 2. Re: How to use Text.Printf w/ custom types (Norbert Melzer) 3. Re: How to use Text.Printf w/ custom types (Baa) 4. Re: How to use Text.Printf w/ custom types (Norbert Melzer) 5. Re: How to use Text.Printf w/ custom types (David McBride) ---------------------------------------------------------------------- Message: 1 Date: Fri, 24 Nov 2017 14:30:49 +0200 From: Baa <aqua...@gmail.com> To: beginners@haskell.org Subject: [Haskell-beginners] How to use Text.Printf w/ custom types Message-ID: <20171124143049.2cae557e@Pavel> Content-Type: text/plain; charset=US-ASCII Hello All! As I understand to use Text.Printf.printf with custom types or to return result as Text instead of String I must implement some class instances: PrintfType, PrintfArg. But how to do this if they are exported from module as type-names only - without its methods (i.e. not "Printf (..)", but "Printf") ? I tried to import Text.Printf.Internal but seems that no such submodule... Any ideas? === Best regards, Paul ------------------------------ Message: 2 Date: Fri, 24 Nov 2017 12:53:55 +0000 From: Norbert Melzer <timmel...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] How to use Text.Printf w/ custom types Message-ID: <CA+bCVssk1iKj=vxUVG-SRXjuNA=rqcke7ylqb2yg-do-cve...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" According to https://hackage.haskell.org/package/base-4.10.0.0/docs/Text-Printf.html#g:2, you only need to implement `PrintfArg`. There is also an example for `()`. Baa <aqua...@gmail.com> schrieb am Fr., 24. Nov. 2017 um 13:33 Uhr: > Hello All! > > As I understand to use Text.Printf.printf with custom types or to > return result as Text instead of String I must implement some > class instances: PrintfType, PrintfArg. But how to do this if they are > exported from module as type-names only - without its methods (i.e. not > "Printf (..)", but "Printf") ? > > I tried to import Text.Printf.Internal but seems that no such > submodule... > > Any ideas? > > === > Best regards, Paul > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20171124/722b06e5/attachment-0001.html> ------------------------------ Message: 3 Date: Fri, 24 Nov 2017 15:19:40 +0200 From: Baa <aqua...@gmail.com> To: beginners@haskell.org Subject: Re: [Haskell-beginners] How to use Text.Printf w/ custom types Message-ID: <20171124151940.2bae3550@Pavel> Content-Type: text/plain; charset=US-ASCII But how to do it if "methods" are not exporting? > According to > https://hackage.haskell.org/package/base-4.10.0.0/docs/Text-Printf.html#g:2, > you only need to implement `PrintfArg`. There is also an example for > `()`. > > Baa <aqua...@gmail.com> schrieb am Fr., 24. Nov. 2017 um 13:33 Uhr: > > > Hello All! > > > > As I understand to use Text.Printf.printf with custom types or to > > return result as Text instead of String I must implement some > > class instances: PrintfType, PrintfArg. But how to do this if they > > are exported from module as type-names only - without its methods > > (i.e. not "Printf (..)", but "Printf") ? > > > > I tried to import Text.Printf.Internal but seems that no such > > submodule... > > > > Any ideas? > > > > === > > Best regards, Paul > > _______________________________________________ > > Beginners mailing list > > Beginners@haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > ------------------------------ Message: 4 Date: Fri, 24 Nov 2017 13:23:54 +0000 From: Norbert Melzer <timmel...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] How to use Text.Printf w/ custom types Message-ID: <CA+bCVstXsHDYKm=vf5w6ehvseeepysqe8ksaa1o8jzecp4w...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Which methods? Just doing this should be sufficient: ``` instance PrintfArg YourType where formatArg _ _ = Text.pack "It works (well, nearly)" ``` Baa <aqua...@gmail.com> schrieb am Fr., 24. Nov. 2017 um 14:20 Uhr: > But how to do it if "methods" are not exporting? > > > According to > > > https://hackage.haskell.org/package/base-4.10.0.0/docs/Text-Printf.html#g:2 > , > > you only need to implement `PrintfArg`. There is also an example for > > `()`. > > > > Baa <aqua...@gmail.com> schrieb am Fr., 24. Nov. 2017 um 13:33 Uhr: > > > > > Hello All! > > > > > > As I understand to use Text.Printf.printf with custom types or to > > > return result as Text instead of String I must implement some > > > class instances: PrintfType, PrintfArg. But how to do this if they > > > are exported from module as type-names only - without its methods > > > (i.e. not "Printf (..)", but "Printf") ? > > > > > > I tried to import Text.Printf.Internal but seems that no such > > > submodule... > > > > > > Any ideas? > > > > > > === > > > Best regards, Paul > > > _______________________________________________ > > > Beginners mailing list > > > Beginners@haskell.org > > > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20171124/1611c374/attachment-0001.html> ------------------------------ Message: 5 Date: Fri, 24 Nov 2017 08:24:54 -0500 From: David McBride <toa...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] How to use Text.Printf w/ custom types Message-ID: <CAN+Tr41dKRMZskMcdKTT6fD5vY=31j7azf0j5xhcmsqomkj...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" It appears PrintfArg and its methods are fully exported. On Fri, Nov 24, 2017 at 8:19 AM, Baa <aqua...@gmail.com> wrote: > But how to do it if "methods" are not exporting? > > > According to > > https://hackage.haskell.org/package/base-4.10.0.0/docs/ > Text-Printf.html#g:2, > > you only need to implement `PrintfArg`. There is also an example for > > `()`. > > > > Baa <aqua...@gmail.com> schrieb am Fr., 24. Nov. 2017 um 13:33 Uhr: > > > > > Hello All! > > > > > > As I understand to use Text.Printf.printf with custom types or to > > > return result as Text instead of String I must implement some > > > class instances: PrintfType, PrintfArg. But how to do this if they > > > are exported from module as type-names only - without its methods > > > (i.e. not "Printf (..)", but "Printf") ? > > > > > > I tried to import Text.Printf.Internal but seems that no such > > > submodule... > > > > > > Any ideas? > > > > > > === > > > Best regards, Paul > > > _______________________________________________ > > > Beginners mailing list > > > Beginners@haskell.org > > > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20171124/2750fa6e/attachment.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 113, Issue 22 ******************************************