<html><head></head><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:16px"><div dir="ltr" id="yui_3_16_0_1_1445608535061_3600">Hello, I'm writing a Haskell code which consists to read a text file, parse it and thansform the parsing result on a specific language.</div><div id="yui_3_16_0_1_1445608535061_4429" dir="ltr">I have a function <b>affiche </b>which takes a data type Ctrl and returns a String. This is the transformation funtion.</div><div id="yui_3_16_0_1_1445608535061_4486" dir="ltr">I have also anothe function parsctrl, which parse the c<span id="result_box" class="" lang="en"><span id="yui_3_16_0_1_1445608535061_4492" class="">ontents of a text file ("ctrl.txt") and after looks for a specific value ("A01") in the parse result (function <b>c</b></span></span><b>herchectrl</b>). <br></div><div id="yui_3_16_0_1_1445608535061_3607" dir="ltr">I need to use the result of the <b id="yui_3_16_0_1_1445608535061_5844">parsectrl </b>function in another function <b>fc</b>.  <br></div><div id="yui_3_16_0_1_1445608535061_4633" dir="ltr">The code is composed of three functions <br></div><div id="yui_3_16_0_1_1445608535061_4765" dir="ltr"><br></div><div id="yui_3_16_0_1_1445608535061_5742" dir="ltr"><br></div><div id="yui_3_16_0_1_1445608535061_3785" dir="ltr"><br></div><div id="yui_3_16_0_1_1445608535061_3808" dir="ltr">parsectrl = do<br class="" id="yui_3_16_0_1_1445608535061_3787"> f <- readFile "ctrl.txt"<br class="" id="yui_3_16_0_1_1445608535061_3789"> let Right r = parse  parseCtrl  " " f</div><div id="yui_3_16_0_1_1445608535061_4088" dir="ltr"> let rez =cherchectrl ( r) "A01"<br class="" id="yui_3_16_0_1_1445608535061_4558"> return (rez)</div><div id="yui_3_16_0_1_1445608535061_4369" dir="ltr"><br></div><div id="yui_3_16_0_1_1445608535061_4417" dir="ltr">fc[]  =[] <br class="" id="yui_3_16_0_1_1445608535061_4718">fc((door,[(all,v1),(alt,v2),(lint,v3),(w,v4),(r,v5),(loc,v6),( etat,v7),(ruin,v8)]):ls ) = ("&OUV ID='"++door ++"', ALLEGE="++show((moi v1)/1000)++", LINTEAU="++show((moi v3)/1000)++", LARGEUR="++show((moi v4)/1000)++", COEF=0.7, ALT="++show((moi v2)/1000)++", LOCIDS='"++v6++"', CTRLID='"++ v7++"', CTRLID_RUIN='"++ v8++" /" ++"\n" ++"&CTRL ID='"++v7++"', " ++ "ON_INI=.FALSE., DURATION=0 / \n"++"&CTRL ID='"++v8++"', LOCID='"++  ((parses("'"++v6++"'"))!!0) ++<font id="yui_3_16_0_1_1445608535061_5998" color="#cd232c"><b id="yui_3_16_0_1_1445608535061_5997">affiche(parsectrl)</b></font>++ " / \n\n"  )++fc(ls)<br></div><div id="yui_3_16_0_1_1445608535061_4419" dir="ltr"><br></div><div id="yui_3_16_0_1_1445608535061_3805" dir="ltr">The parsectrl returns an IO String, but the function affiche needs a String as input and even when I tried to adapt the affiche function to take an  IO String -> String I can't.</div><div id="yui_3_16_0_1_1445608535061_5808" dir="ltr">the result of fc must be a String too.</div><div id="yui_3_16_0_1_1445608535061_5863" dir="ltr"><br></div><div id="yui_3_16_0_1_1445608535061_6028" dir="ltr">The IO String comes from the parsectrl function.<br></div><div id="yui_3_16_0_1_1445608535061_5841" dir="ltr">Can you help me to solve this problem: how can I transform an IO String to a String.</div><div id="yui_3_16_0_1_1445608535061_6151" dir="ltr"><br></div><div id="yui_3_16_0_1_1445608535061_6152" dir="ltr">Thank you by advance.<br></div><div id="yui_3_16_0_1_1445608535061_3806" dir="ltr"><br></div><div id="yui_3_16_0_1_1445608535061_4089" dir="ltr"><br></div><br><br></div></body></html>