# REPL output for subtype of Function

**URL:** <https://discourse.julialang.org/t/repl-output-for-subtype-of-function/5997>\
**Category:** General Usage\
**Created:** [September 20, 2017, 1:00pm UTC](https://discourse.julialang.org/t/repl-output-for-subtype-of-function/5997 "2017-09-20T13:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [September 20, 2017, 1:00pm UTC](https://discourse.julialang.org/t/repl-output-for-subtype-of-function/5997/1 "2017-09-20T13:00:00Z")

</div>

How is one meant I override the default output in the REPL? This early thread [Proper way to hook into REPL display of type](https://discourse.julialang.org/t/proper-way-to-hook-into-repl-display-of-type/2046) seems to suggest using `show`, but this doesn’t work for subtypes of `Function`:

```julia
julia> struct Foo <: Function end

julia> Base.show(io::IO,::Foo) = print(io, "hello")

julia> Foo()
(::Foo) (generic function with 0 methods)

julia> show(Foo())
hello

```

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [September 20, 2017, 3:15pm UTC](https://discourse.julialang.org/t/repl-output-for-subtype-of-function/5997/2 "2017-09-20T15:15:35Z")

</div>

```julia
julia> struct Foo <: Function end

julia> Base.show(io::IO, ::MIME"text/plain", ::Foo) = print(io, "Hello")

julia> Foo()
Hello

```

> [@Show for supertype](https://discourse.julialang.org/t/show-for-supertype/5375):
>
> I am trying to organize printing for a set of types the following way: a generic function returns a string representation, then show for the supertype just prints it. MWE: abstract type MyAbstractFun \<: Function end Base.show(io::IO, f::MyAbstractFun) = println(io, representation(f)) struct One \<: MyAbstractFun end (::One)(x) = x+1 representation(::One) = "just adds one" but then evaluating at the REPL (ie going through display) gives me the standard printing from Base, while show works correc…
