<div dir="ltr">I don't have pg installed so I can't run your code but I assume you are breaking on the vector pattern matching.  Pattern matching using : only works because the : operator is a constructor in lists.<br>
<br>>:i (:)<br>data [] a = ... | a : [a]<br><br>Remember that : is an infix operator, but it is comparable to Just, Left, or Right.  You are trying to use a list constructor to pattern match on a vector which looks nothing like a list.<br>
<br>However you can do this sort of pattern matching by using vector's (or almost any other collection's) toList function:<br><br>hostaddr:port:dbname:username:password:rest = toList vec<br><br><- is a monadic binding. You use it when you are dealing with a datatype that happens to be an instance of Monad.  It happens to be the only way to get anything out of an IO type, which is what you are using it for here.  If something is just using plain types, Int, String, etc, just use lets.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 5, 2014 at 12:08 PM, Ari King <span dir="ltr"><<a href="mailto:ari.brandeis.king@gmail.com" target="_blank">ari.brandeis.king@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br><br></div>I've posted (on <a href="http://pastebin.com/R5MPNaHs" target="_blank">http://pastebin.com/R5MPNaHs</a>) code I'm working on to practice reading/writing CSV and interacting with DBs. I'd appreciate help in better understanding how to destructure (pattern match) lists/vectors (see line 28 in post) and the difference in "binding" via let/where and <-. I'd also appreciate suggestions on how to improve the code put together thus far to make it more idiomatic. Thanks.<br>

<br></div><div>Best,<br>Ari<br></div><div><br></div><br></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>