While commenting on new features in ghci I wished that ghci had the ability to declare type declaration and declaring new ADT types, someone informed that it was indeed possible, and after searching I found
this page which told me I could do
let numUniques' :: (Eq a) => [a] -> Int; numUniques' = length . nub
Apparently that same sort of syntax works for pattern matching (ex. let a 1=True;a 2=False).
Creating ADTs would make it almost perfect? Does anyone know if it is currently possible?
Should I just make an ADT scratch file and reload it?
P.S. Does anyone know if there are any plans to do so? Are there feature requests for ghc(i)?
Also I know its open source but I’m not currently smart enough to hack on ghc(i).
No, but you could define new types in hbi (an earlier interpreter). There’s discussion about bringing this back, via a ghci library on hackage.