Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Creating an exe file (legajid)
   2. Re:  Creating an exe file (Deniz Dogan)
   3.  cabal haddock problem (Ashish Agarwal)
   4.  University project - weird problem (Renato dos Santos Leal)
   5.  cabal re-configure not recognized (Ashish Agarwal)
   6. Re:  University project - weird problem
      (Stephen Blackheath [to Haskell-Beginners])


----------------------------------------------------------------------

Message: 1
Date: Wed, 21 Apr 2010 22:33:09 +0200
From: legajid <[email protected]>
Subject: [Haskell-beginners] Creating an exe file
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi,

After running interpreted programs, i want to create an exe file; in a 
first time, just for my local machine. Later shall i try to install on 
other machines ...
To do this, i wrote a batch file :

d:
cd d:\prog\lang\haskell
set shs=%1
ghc %shs% -o%shs:hs=exe%
del %shs:hs=hi%
del %shs:hs=o%
pause

where %1 is my hs file full path.

Example of a run :
D:\>cd d:\prog\lang\haskell
D:\PROG\lang\haskell>set shs=E:\didier\haskell\cases.hs
D:\PROG\lang\haskell>ghc E:\didier\haskell\cases.hs 
-oE:\didier\haskell\cases.exe
D:\PROG\lang\haskell>del E:\didier\haskell\cases.hi
D:\PROG\lang\haskell>del E:\didier\haskell\cases.o
D:\PROG\lang\haskell>pause
Appuyez sur une touche pour continuer...

It's ok with some modules i have to import, like
import Data.List
import Data.Maybe

But, when using wxhaskell, i get a lot of errors, although i include
import Graphics.UI.WXCore
import Graphics.UI.WX

here is a small list of errors :

E:\didier\haskell\graphe.o:fake:(.data+0x2f0): undefined reference to 
`wxcorezm0zi11zi1zi2_GraphicsziUIziWXCoreziDialogs_infoDialog_closure'
E:\didier\haskell\graphe.o:fake:(.data+0x300): undefined reference to 
`wxzm0zi11zi1zi2_GraphicsziUIziWXziDraw_zdf4_closure'
E:\didier\haskell\graphe.o:fake:(.data+0x314): undefined reference to 
`wxzm0zi11zi1zi2_GraphicsziUIziWXziDraw_zdf4_closure'

what should the correct ghc command line be, in order to get a 
successful compilation ?

Thanks for help,
Didier

Running ghc 6.10.4 on Windows XP SP2, with wxhaskell-0.11.1.2




------------------------------

Message: 2
Date: Wed, 21 Apr 2010 22:44:17 +0200
From: Deniz Dogan <[email protected]>
Subject: Re: [Haskell-beginners] Creating an exe file
To: legajid <[email protected]>
Cc: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

2010/4/21 legajid <[email protected]>:
> Hi,
>
> After running interpreted programs, i want to create an exe file; in a first
> time, just for my local machine. Later shall i try to install on other
> machines ...
> To do this, i wrote a batch file :
>
> d:
> cd d:\prog\lang\haskell
> set shs=%1
> ghc %shs% -o%shs:hs=exe%
> del %shs:hs=hi%
> del %shs:hs=o%
> pause
>
> where %1 is my hs file full path.
>
> Example of a run :
> D:\>cd d:\prog\lang\haskell
> D:\PROG\lang\haskell>set shs=E:\didier\haskell\cases.hs
> D:\PROG\lang\haskell>ghc E:\didier\haskell\cases.hs
> -oE:\didier\haskell\cases.exe
> D:\PROG\lang\haskell>del E:\didier\haskell\cases.hi
> D:\PROG\lang\haskell>del E:\didier\haskell\cases.o
> D:\PROG\lang\haskell>pause
> Appuyez sur une touche pour continuer...
>
> It's ok with some modules i have to import, like
> import Data.List
> import Data.Maybe
>
> But, when using wxhaskell, i get a lot of errors, although i include
> import Graphics.UI.WXCore
> import Graphics.UI.WX
>
> here is a small list of errors :
>
> E:\didier\haskell\graphe.o:fake:(.data+0x2f0): undefined reference to
> `wxcorezm0zi11zi1zi2_GraphicsziUIziWXCoreziDialogs_infoDialog_closure'
> E:\didier\haskell\graphe.o:fake:(.data+0x300): undefined reference to
> `wxzm0zi11zi1zi2_GraphicsziUIziWXziDraw_zdf4_closure'
> E:\didier\haskell\graphe.o:fake:(.data+0x314): undefined reference to
> `wxzm0zi11zi1zi2_GraphicsziUIziWXziDraw_zdf4_closure'
>
> what should the correct ghc command line be, in order to get a successful
> compilation ?
>
> Thanks for help,
> Didier
>
> Running ghc 6.10.4 on Windows XP SP2, with wxhaskell-0.11.1.2
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>

Try adding --make to the ghc call.

-- 
Deniz Dogan


------------------------------

Message: 3
Date: Wed, 21 Apr 2010 18:30:14 -0400
From: Ashish Agarwal <[email protected]>
Subject: [Haskell-beginners] cabal haddock problem
To: Haskell-beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

I've setup a cabal file for a project. Building works fine but cabal haddock
gives the following error:

src/AFRP/AFRP.hs:1:0:
    File name does not match module name:
    Saw: `Main'
    Expected: `AFRP.AFRP'

However, the module name specified in AFRP.hs is in fact AFRP.AFRP so why is
haddock seeing Main, especially since cabal build completes successfully?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100421/d6760062/attachment-0001.html

------------------------------

Message: 4
Date: Wed, 21 Apr 2010 19:42:51 -0300
From: Renato dos Santos Leal <[email protected]>
Subject: [Haskell-beginners] University project - weird problem
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

I've got a university project that demands me to do a program that receive a
.c file and analyze its syntax using haskell.
There are just a few things that I have to analyze:
literal strings, identifiers (in the program: identificadores), constants
(constantes), operators (operadores) and reserverd words(palavras
reservadas)

There are two major problems in the program:

(1) I've got this guard in le_bloco: | x `elem` listS = do separador (x:xs)
but it doesn't seem to work. Every time I enable it I recieve this in
execution time (after calling verifica)

ERROR - Cannot find "show" function for:
*** Expression : verifica
*** Of type    : IO a

So I've made one workaround that prints the separator but stops the
program...I guess the problem is doing the recursivity

(2) My second problem is: when I have one identifier or keyword alone in a
line or it's the last element of it it just won't print my coment!
this is the function:

pPCouI (x:xs) z
    | membroPC z = do{ putStr (z ++ " <palavra chave>\n") ; le_bloco (x:xs)}
    | otherwise = do{putStr z ; putStr " <identificador>\n" ; le_bloco
(x:xs)}

*Please help me solving those problems as soon as possible!*

Here is the whole program:

listO = ['+', '-', '*', '/', '%', '^', '=', '>', '<', '.', '|', '&', '!',
'~']
listS = [';', '{', '(', ')', '}', '[', ']', ',']
listC = ['0','1'..'9']
listCF = listC ++ ['.']
listA = listO ++ listS ++ [' ']
listPC =
["auto","double","int","struct","break","else","long","switch","case",

"enum","register","typedef","char","extern","return","union","const",

"float","short","unsigned","continue","for","signed","void","default",
          "goto","sizeof","volatile","do","if","static","while"]

verifica = do
    putStr ("Favor visualizar o codigo para ver os bugs e erros do
programa\n")
    putStr ("Digite o nome do arquivo de entrada: ")
    arqent <- getLine
    texto <- readFile arqent
    le_bloco texto

le_bloco (x:xs)
    | x `elem` listO = do operador (x:xs)
    | x `elem` listC = do cnum (x:xs)
  --  | x `elem` listS = do separador (x:xs)
    | x `elem` listS = do{ putStr[x] ; putStr " <separador>\n" }
    | x == '"' = litstr (xs)
    | x /= ' ' = pchave (x:xs) []
    | x == ' ' = le_bloco xs
    | otherwise    = do { putStr "Outro\n" ; le_bloco xs }

separador (x:xs)
    | x `elem` listS = do{ putStr [x] ; separador xs}
    | otherwise = do{ putStr " <separador>\n" ; le_bloco xs}

cnum (x:xs)
    | x `elem` listCF = do{ putChar x ; cnum xs}
    | otherwise = do{ putStr " <cte. numerica>\n" ; le_bloco (x:xs)}

operador (x:xs)
    | x `elem` listO = do{ putChar x ; operador xs}
    | otherwise = do{ putStr " <operador>\n" ; le_bloco (x:xs)}

litstr (x:xs)
    | x /= '"' = do{ putChar x ; litstr xs}
    | otherwise = do{ putStr " <literal string>\n" ; le_bloco xs}

pchave (x:xs) ys
    | x `notElem` listA = pchave xs (ys++[x])
    | otherwise = pPCouI (x:xs) ys

pPCouI (x:xs) z
    | membroPC z = do{ putStr (z ++ " <palavra chave>\n") ; le_bloco (x:xs)}
    | otherwise = do{putStr z ; putStr " <identificador>\n" ; le_bloco
(x:xs)}

membroPC x
    | x `elem` listPC = True
    | otherwise = False

I'm sorry for the bad english, it's been a while since the last time i used
it =)
Ah, I'm just starting to learn Haskell, first time i've seen it was like a
month ago so pretend that I know nothing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100421/9d2c54b1/attachment-0001.html

------------------------------

Message: 5
Date: Wed, 21 Apr 2010 19:01:37 -0400
From: Ashish Agarwal <[email protected]>
Subject: [Haskell-beginners] cabal re-configure not recognized
To: Haskell-beginners <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

When changing a cabal file, if one runs 'cabal build' immediately, a message
states that you must re-configure. So I run 'cabal configure' and then again
try 'cabal build', but I get the same message again. The problem goes away
if I wait about a minute. So I suspect there is an issue with the file
modification time being ahead of what cabal thinks the time is. Has anyone
experienced this problem, and know what might be the fix? Thank you. The
issue occurs only on my Ubuntu machine. I do not have this problem with the
same code on Mac OS X.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100421/0a8d96d8/attachment-0001.html

------------------------------

Message: 6
Date: Thu, 22 Apr 2010 11:03:57 +1200
From: "Stephen Blackheath [to Haskell-Beginners]"
        <[email protected]>
Subject: Re: [Haskell-beginners] University project - weird problem
To: Renato dos Santos Leal <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Renato,

All I did was I added type signatures to your code, and it worked.  It 
is a very good idea to put type signatures on all top-level functions, 
otherwise you can get confusing errors.

It looks like you are using Hugs - It is much better to use GHC.  That's 
what everyone uses now.

Another thing:  For a program this size it doesn't matter much, but in 
Haskell we always try to make our functions pure if we can (that is, not 
IO type).  Then you get the best advantage out of using Haskell.


Steve

listO = ['+', '-', '*', '/', '%', '^', '=', '>', '<', '.', '|', '&', 
'!', '~']
listS = [';', '{', '(', ')', '}', '[', ']', ',']
listC = ['0','1'..'9']
listCF = listC ++ ['.']
listA = listO ++ listS ++ [' ']
listPC = 
["auto","double","int","struct","break","else","long","switch","case",
 
"enum","register","typedef","char","extern","return","union","const",
 
"float","short","unsigned","continue","for","signed","void","default",
           "goto","sizeof","volatile","do","if","static","while"]

verifica :: IO ()
verifica = do
     putStr ("Favor visualizar o codigo para ver os bugs e erros do 
programa\n")
     putStr ("Digite o nome do arquivo de entrada: ")
     arqent <- getLine
     texto <- readFile arqent
     le_bloco texto

le_bloco :: String -> IO ()
le_bloco (x:xs)
     | x `elem` listO = do operador (x:xs)
     | x `elem` listC = do cnum (x:xs)
   --  | x `elem` listS = do separador (x:xs)
     | x `elem` listS = do{ putStr[x] ; putStr " <separador>\n" }
     | x == '"' = litstr (xs)
     | x /= ' ' = pchave (x:xs) []
     | x == ' ' = le_bloco xs
     | otherwise    = do { putStr "Outro\n" ; le_bloco xs }

separador :: String -> IO ()
separador (x:xs)
     | x `elem` listS = do{ putStr [x] ; separador xs}
     | otherwise = do{ putStr " <separador>\n" ; le_bloco xs}

cnum :: String -> IO ()
cnum (x:xs)
     | x `elem` listCF = do{ putChar x ; cnum xs}
     | otherwise = do{ putStr " <cte. numerica>\n" ; le_bloco (x:xs)}

operador :: String -> IO ()
operador (x:xs)
     | x `elem` listO = do{ putChar x ; operador xs}
     | otherwise = do{ putStr " <operador>\n" ; le_bloco (x:xs)}

litstr :: String -> IO ()
litstr (x:xs)
     | x /= '"' = do{ putChar x ; litstr xs}
     | otherwise = do{ putStr " <literal string>\n" ; le_bloco xs}

pchave :: String -> String -> IO ()
pchave (x:xs) ys
     | x `notElem` listA = pchave xs (ys++[x])
     | otherwise = pPCouI (x:xs) ys

pPCouI :: String -> String -> IO ()
pPCouI (x:xs) z
     | membroPC z = do{ putStr (z ++ " <palavra chave>\n") ; le_bloco 
(x:xs)}
     | otherwise = do{putStr z ; putStr " <identificador>\n" ; le_bloco 
(x:xs)}

membroPC :: String -> Bool
membroPC x
     | x `elem` listPC = True
     | otherwise = False


Renato dos Santos Leal wrote:
> I've got a university project that demands me to do a program that 
> receive a .c file and analyze its syntax using haskell.
> There are just a few things that I have to analyze:
> literal strings, identifiers (in the program: identificadores), 
> constants (constantes), operators (operadores) and reserverd 
> words(palavras reservadas)
> 
> There are two major problems in the program:
> 
> (1) I've got this guard in le_bloco: | x `elem` listS = do separador (x:xs)
> but it doesn't seem to work. Every time I enable it I recieve this in 
> execution time (after calling verifica)
> 
> ERROR - Cannot find "show" function for:
> *** Expression : verifica
> *** Of type    : IO a
> 
> So I've made one workaround that prints the separator but stops the 
> program...I guess the problem is doing the recursivity
> 
> (2) My second problem is: when I have one identifier or keyword alone in 
> a line or it's the last element of it it just won't print my coment!
> this is the function:
> 
> pPCouI (x:xs) z
>     | membroPC z = do{ putStr (z ++ " <palavra chave>\n") ; le_bloco (x:xs)}
>     | otherwise = do{putStr z ; putStr " <identificador>\n" ; le_bloco 
> (x:xs)}
> 
> *Please help me solving those problems as soon as possible!*
> 
> Here is the whole program:
> 
> listO = ['+', '-', '*', '/', '%', '^', '=', '>', '<', '.', '|', '&', 
> '!', '~']
> listS = [';', '{', '(', ')', '}', '[', ']', ',']
> listC = ['0','1'..'9']
> listCF = listC ++ ['.']
> listA = listO ++ listS ++ [' ']
> listPC = 
> ["auto","double","int","struct","break","else","long","switch","case",
>           
> "enum","register","typedef","char","extern","return","union","const",
>           
> "float","short","unsigned","continue","for","signed","void","default",
>           "goto","sizeof","volatile","do","if","static","while"]
> 
> verifica = do
>     putStr ("Favor visualizar o codigo para ver os bugs e erros do 
> programa\n")
>     putStr ("Digite o nome do arquivo de entrada: ")
>     arqent <- getLine
>     texto <- readFile arqent
>     le_bloco texto
>    
> le_bloco (x:xs)
>     | x `elem` listO = do operador (x:xs)
>     | x `elem` listC = do cnum (x:xs)
>   --  | x `elem` listS = do separador (x:xs)
>     | x `elem` listS = do{ putStr[x] ; putStr " <separador>\n" }
>     | x == '"' = litstr (xs)
>     | x /= ' ' = pchave (x:xs) []
>     | x == ' ' = le_bloco xs
>     | otherwise    = do { putStr "Outro\n" ; le_bloco xs }
> 
> separador (x:xs)
>     | x `elem` listS = do{ putStr [x] ; separador xs}
>     | otherwise = do{ putStr " <separador>\n" ; le_bloco xs}
>    
> cnum (x:xs)
>     | x `elem` listCF = do{ putChar x ; cnum xs}
>     | otherwise = do{ putStr " <cte. numerica>\n" ; le_bloco (x:xs)}
>    
> operador (x:xs)
>     | x `elem` listO = do{ putChar x ; operador xs}
>     | otherwise = do{ putStr " <operador>\n" ; le_bloco (x:xs)}
>    
> litstr (x:xs)
>     | x /= '"' = do{ putChar x ; litstr xs}
>     | otherwise = do{ putStr " <literal string>\n" ; le_bloco xs}
> 
> pchave (x:xs) ys
>     | x `notElem` listA = pchave xs (ys++[x])
>     | otherwise = pPCouI (x:xs) ys
>    
> pPCouI (x:xs) z
>     | membroPC z = do{ putStr (z ++ " <palavra chave>\n") ; le_bloco (x:xs)}
>     | otherwise = do{putStr z ; putStr " <identificador>\n" ; le_bloco 
> (x:xs)}
>    
> membroPC x
>     | x `elem` listPC = True
>     | otherwise = False
> 
> I'm sorry for the bad english, it's been a while since the last time i 
> used it =)
> Ah, I'm just starting to learn Haskell, first time i've seen it was like 
> a month ago so pretend that I know nothing
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners


------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 22, Issue 31
*****************************************

Reply via email to