[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] interactive coding in Haskell Re: [sc-dev] Towards SC 4

Em 20-11-2013 12:31, Renick Bell escreveu:
>> 1* none of those languages had a usable (for me) just in time coding
>> environment, i.e. live coding. Haskell has emacs bindings but I'm not an
>> emacs persoon (yet), so I couldn't use that, even with that you can't
>> really do proper live coding of functions etc. Compile/run just doesn't
>> cut it for me, I need to select text and execute.
> Selecting text and editing is certainly possible for me using a
> combination of ghci (the haskell interpreter), vim, and tmux.

Now that I remember I was also able to do in Leksah. When using static
typing interactive coding is a bit more weird, since you can change the
type of an entity. In ghc it seems when you change the type of a
function it seems the new version is not retroactive, which makes sense,
but is also a bit difficult to reason about. Anwyay a discussion for
other mailing lists...


GHCi, version 7.6.3: 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> let f x = x + 1
Prelude> f 1
Prelude> let g x = f x * 4
Prelude> g 4
Prelude> let f x = x ++ "hello"
Prelude> f 4

    No instance for (Num [Char]) arising from the literal `4'
    Possible fix: add an instance declaration for (Num [Char])
    In the first argument of `f', namely `4'
    In the expression: f 4
    In an equation for `it': it = f 4

Prelude> f "he"
Prelude> g 3

Attachment: signature.asc
Description: OpenPGP digital signature