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

Re: [sc-dev] Re: Towards SC 4



Em 06-12-2013 23:30, Rohan Drape escreveu:
> Dear List (& Miguel),
> 
> This is all a little off-topic here, so very briefly.
> 
> I'm afraid I can't help about non-Emacs editors.
> 
> About types & references though:
> 
> Haskell does has various forms of mutable references.
> 
> The notation is different, but the type constraints are
> the same as those in sclanguage.
> 
> In sclanguage, if you change the latent type of a value
> bound to a reference you will get an error when you try
> to use the value.
> 
> f = 5;
> g = {|n| f - n};
> g.(4) == 1;
> f = "5";
> g.(4); /* ==> error */
> 
> In haskell the interpreter won't let you write a type
> incoherent value to a reference.
> 
> It's more or less the "same difference"?
> 
> The error arrives one step earlier.
> 
> f <- newIORef (5::Integer)
> let g n = fmap (subtract n) (readIORef f)
> fmap (== 1) (g 4)
> writeIORef f "5" {- ==> error -}
> 
> But mutable references are like heterogenous sequences,
> rather esoteric & only very rarely necessary!

Hi Rohan, Renick,

Thanks for clarifying, it looks like redefining functions in haskell is
not an issue as you show aboce, as long as you can access ghci via a
suitable text editor with multiline execution of code blocks (e.g.
emacs, vim). So I would redifine my issue as, for those that are not
going to use emacs or vim it's still difficult to use haskell
interactivelly. It would be cool if there was something like scide for
interfacing with haskell via ghci, for those of us un-initiated in
emacs/vim. :-)

best,
Miguel


Attachment: signature.asc
Description: OpenPGP digital signature