On 05/12/2014 10:15 PM, Vladimír Čunát wrote: > On 05/11/2014 09:50 AM, Roelof Wobben wrote: >> but can someone explain to me what holes and missing cases are. > > I don't know that. GHC traditionally also implements optional > research-level features, so something from those, I presume.
Holes are things where you ask the compiler to tell you the type of the expression that you need to fill in. For example, if we denote holes with ‘?’: foo :: [String] -> [Integer] foo xs = map ? xs The compiler might tell us that the hole is expecting an expression of type ‘String -> Integer’. This is a new feature in GHC although Agda had it for a while. Prelude> let foo :: [String] -> [Integer]; foo xs = map _ xs in foo [] <interactive>:2:48: Found hole ‘_’ with type: String -> Integer Relevant bindings include xs :: [String] (bound at <interactive>:2:39) foo :: [String] -> [Integer] (bound at <interactive>:2:35) it :: [Integer] (bound at <interactive>:2:1) In the first argument of ‘map’, namely ‘_’ In the expression: map _ xs In an equation for ‘foo’: foo xs = map _ xs The reason it's coming up in an IDE thread is that you can do very nice things with this: for example, agda-mode for emacs lets you jump between holes, try to find the things to insert automatically, refine into smaller chunks etc. Missing cases is probably referring to the ability of the compiler to tell you whether your patterns are complete: Prelude> :set -Wall Prelude> let f [] = "Hello" in f [] <interactive>:6:5: Warning: Pattern match(es) are non-exhaustive In an equation for ‘f’: Patterns not matched: _ : _ "Hello" I'm unsure why this is coming up in an IDE thread except maybe with the IDE being able to highlight such cases or something. Case splitting is a much more useful feature I feel. > Anyway, I don't think there's any need for you to care about such things > (yet) if you're just starting with Haskell. Haskell2010 contains quite a > lot to grasp by itself. Actually, programming with holes can make for a great development tool for beginners and experts alike (combined with ScopedTypeVariables) and ability to report missing cases is invaluable. I do agree that OP shouldn't be seeking a fully-featured IDE which will handle all the Cabal stuff and everything around it behind-the-scenes because when it breaks, he won't know what to do. Honestly I'm not quite sure why this thread ended up on nix-dev rather than haskell-cafe or haskell-beginners. > > Vlada > > > > > _______________________________________________ > nix-dev mailing list > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev > -- Mateusz K. _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev