is there such thing as a typed interpreted language? I mean one with a REPL, not Java.
Of course. Examples:
▶ ocaml
OCaml version 4.02.3
# 9;;
- : int = 9
▶ ghci
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 9
9
Prelude> :t 9
9 :: Num a => a
Prelude>
▶ drracket
Welcome to DrRacket, version 6.3.0.2--2015-10-28(-/f) [3m].
Language: typed/racket; memory limit: 128 MB.
> 9
- : Integer [more precisely: Positive-Byte]
9
▶ scala
Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.8.0_91).
Type in expressions to have them evaluated.
Type :help for more information.
scala> 9
res0: Int = 9
There are even interpreters for C (http://www.drdobbs.com/cpp/ch-a-cc-interpreter-for-script-co...).tl;dr: you can have a REPL in both statically and dynamically typed languages.
(Typing is optional)
I think the question you mean -- which I'm also interested in the answer to -- is: How can a dynamically typed language be statically type checked? Presumably Hindley-Milner style inference doesn't/can't work. Do static analysers such as Mypy therefore trace the execution of the code until it finds something that conflicts? Are there cases where this approach won't work, either technically or practically?
Via runtime tags, which are not the same as types.