2 golf
source | link

ScopedTypeVariables, 119119 97 bytes

Just copied from mauke with small modifications.

Currently there are two other answers for ScopedTypeVariables: 113 bytes by Csongor Kiss and 37 bytes by dfeuer. This submission is different in that it does not require other Haskell extensions.

-22 bytes thanks to Ørjan Johansen.

class(Show a,Num a)=>S a where s::a->String;s=const$show>IO(f 0)where;s f=id_=print$(id::a->a)0
instance S DoubleFloat
main=print$smain=s(0::DoubleFloat)

Try it online!Try it online!

ScopedTypeVariables, 119 bytes

Just copied from mauke with small modifications.

Currently there are two other answers for ScopedTypeVariables: 113 bytes by Csongor Kiss and 37 bytes by dfeuer. This submission is different in that it does not require other Haskell extensions.

class(Show a,Num a)=>S a where s::a->String;s=const$show(f 0)where f=id::a->a
instance S Double
main=print$s(0::Double)

Try it online!

ScopedTypeVariables, 119 97 bytes

Just copied from mauke with small modifications.

Currently there are two other answers for ScopedTypeVariables: 113 bytes by Csongor Kiss and 37 bytes by dfeuer. This submission is different in that it does not require other Haskell extensions.

-22 bytes thanks to Ørjan Johansen.

class(Show a,Num a)=>S a where s::a->IO();s _=print$(id::a->a)0
instance S Float
main=s(0::Float)

Try it online!

1
source | link

ScopedTypeVariables, 119 bytes

Just copied from mauke with small modifications.

Currently there are two other answers for ScopedTypeVariables: 113 bytes by Csongor Kiss and 37 bytes by dfeuer. This submission is different in that it does not require other Haskell extensions.

class(Show a,Num a)=>S a where s::a->String;s=const$show(f 0)where f=id::a->a
instance S Double
main=print$s(0::Double)

Try it online!