I do a lot of exploratory coding in GHCi, and as such, I'm tinkering with a script to persist definitions across GHCi sessions and reloads like so:*> :sr narp = putStrLn "Narp!" *> :do m <- return "Ok" *> narp Narp! *> m "Ok" *> :q ...>ghci *> :ls *> narp Narp! *> m "Ok"
... and I've run into a snag. If I use :sr to define a function which does not type check, I still persist it. Now, I do have a :dl command to delete the last definition persisted with :sr, but that is subject to human error. Is there any fairly simple trick I'm overlooking that would let me catch this automatically?
Alternatively, is there something that already does this so I don't have to?submitted by WarDaft
[link] [4 comments]
The question is in the title. I know that with the reducers, I can transformgetSum $ mconcat (map Sum xs)
to something like getSum $ reduce?? xs
or??? getSum xs
But it always take me half an hour to figure out which import to do and which function to call. This package seems great though.
In the example I gave, it doesn't look really usefull, but it is when you reducing tuples and could do thing like(getSum a, getSum b, getMax c) = reduce??? [(1,2,3), (4,5,6)] submitted by maxigit
[link] [2 comments]