ikaros has quit [Remote host closed the connection]
sohum has joined #ocaml
<sohum>
so, if I have a let PatternMatch(x) = foo in ..., and it's inexhaustive, and I want to get rid of the inexhaustive patterns warning, what's the simplest way to do that?
<sohum>
it's an error, btw. Yes, I know, I'm not being strict enough with my types, that's not something I can fix now.
ldunn_ has quit [Remote host closed the connection]
<Tobu>
Match _, and use failwith to raise an exception
<sohum>
so I have to rewrite it as match foo with ... ?
<adrien>
the idea is that no matter what you match against, the program knows what to do, so you have to enumerate each possibility/combination
<adrien>
also, "_" is called the catch-all
<sohum>
I know, I know
<sohum>
I'm just asking if there's a neater way to write that
<sohum>
turning a let bar = foo in <lots of code> into match foo with bar -> <lots of code> | _ -> error ... is not exactly neat
<adrien>
can you show me some code? it's hard to help without
Yoric has joined #ocaml
<sohum>
it's probably not the easiest code to read, which is why I was avoiding that
<adrien>
sohum: why not "chain" pattern-matchs with "match ... with"?
<sohum>
adrien: ?
wormphlegm has quit [Quit: hmm]
<adrien>
sohum: http://ocaml.pastebin.com/FyGGnLwM : I also removed the parens for the let-style pattern matchings, they're not needed but some people prefer them so, you decide but the important part is the 'begin match tyT2, tyT3 with ... end'
<sohum>
adrien: oh, I didn't know you could do that
<sohum>
adrien: that looks excellent, thank you!
<adrien>
=)
<sohum>
although, with hindsight, I should've guessed
<sohum>
it's essentially matching the (tyT2,tyT3) tuple, isn't ot?
<adrien>
but you need the "being ... end" or "( ... )" (equivalent) because it may otherwise mix the two pattern-matchings
<adrien>
yeah, that's why I did there
* sohum
nod
ztfw has joined #ocaml
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
rwmjones_afk is now known as rwmjones
rwmjones is now known as rwmjones_afk
ygrek has quit [Ping timeout: 245 seconds]
ygrek has joined #ocaml
Snark_ has joined #ocaml
bouzu has joined #ocaml
bouzu has quit [Read error: Connection reset by peer]
bouzu has joined #ocaml
bouzu has left #ocaml []
Amorphous has quit [Ping timeout: 264 seconds]
Amorphous has joined #ocaml
avsm has joined #ocaml
boscop has quit [Ping timeout: 264 seconds]
boscop has joined #ocaml
Smerdyakov has joined #ocaml
lpereira has quit [Ping timeout: 252 seconds]
BiDOrD has quit [Quit: BiDOrD]
lpereira has joined #ocaml
avsm has quit [Quit: Leaving.]
Smerdyakov has quit [Quit: Leaving]
BiDOrD has joined #ocaml
DimitryKakadu has joined #ocaml
albacker has joined #ocaml
DimitryKakadu has quit [Ping timeout: 250 seconds]
DimitryKakadu has joined #ocaml
iago has joined #ocaml
DimitryKakadu has quit [Ping timeout: 264 seconds]
albacker has quit [Disconnected by services]
ccasin has joined #ocaml
_unK has joined #ocaml
ygrek has quit [Remote host closed the connection]
Edward_ has joined #ocaml
Smerdyakov has joined #ocaml
jakedouglas has joined #ocaml
ygrek has joined #ocaml
Snark_ has quit [Quit: Ex-Chat]
_unK has quit [Remote host closed the connection]
jakedouglas has quit [Quit: Leaving.]
ikaros has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
jakedouglas has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
_unK has joined #ocaml
jakedouglas has quit [Quit: Leaving.]
ztfw has quit [Remote host closed the connection]
ygrek has quit [Remote host closed the connection]
ikaros has quit [Quit: Leave the magic to Houdini]
Yoric has quit [Quit: Yoric]
lpereira has quit [Quit: Leaving.]
valross has joined #ocaml
xcthulhu has joined #ocaml
_unK has quit [Remote host closed the connection]
ccasin has quit [Quit: Leaving]
fraggle_ has quit [Remote host closed the connection]