[Haskell-cafe] Shrink function names

Brandon Allbery allbery.b at gmail.com
Sun Sep 19 15:23:45 UTC 2021


Hm. Then I bet that's the implicit Typeable derivation and there's nothing
to be done about it because it's used internally.

On Sun, Sep 19, 2021 at 10:58 AM Viktor Dukhovni <ietf-dane at dukhovni.org>
wrote:

> On Sun, Sep 19, 2021 at 07:58:22AM -0400, Brandon Allbery wrote:
>
> > On Sun, Sep 19, 2021 at 3:02 AM Viktor Dukhovni <ietf-dane at dukhovni.org>
> > wrote:
> >
> > > I don't know how to suppress unexported constructor names appearing in
> the
> > > compiled code, perhaps someone else does, or it might not be
> possible...
> >
> > I would ask if there's a "deriving Show" involved.
>
> My test code does not.
>
>     $ rm foo.o foo.hi
>     $ ghc -fhide-source-paths -dno-typeable-binds
> -dsuppress-type-signatures -optl-s -O2 foo.hs
>     [1 of 1] Compiling Main
>     Linking foo ...
>     $ strings -a foo | grep -i secret
>     main:Main.AnotherSecret
>
>     $ cat foo.hs
>     module Main (main) where
>
>     import System.Environment
>     import Data.Maybe
>
>     data SecretName = AnotherSecret String Int
>
>     secretName :: [String] -> Maybe SecretName
>     secretName = fmap (AnotherSecret <$> id <*> (+ 42) . read) .
> listToMaybe
>     {-# NOINLINE secretName #-}
>
>     main :: IO ()
>     main = secretName <$> getArgs >>= mapM_ (\ (AnotherSecret a b) ->
> print (a, b))
>
> With a deriving (Show) instance, I see a second occurence:
>
>     main:Main.AnotherSecret
>     AnotherSecret
>
> --
>     Viktor.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.



-- 
brandon s allbery kf8nh
allbery.b at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210919/53327698/attachment.html>


More information about the Haskell-Cafe mailing list