using both my personal .hs and a library simultaneously + seeing a function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

using both my personal .hs and a library simultaneously + seeing a function

Alexander Chen
Hi,

1) I have my own functions in a .hs file which i can load in winGCHI and use the functions without a problem. But I also need 1 function from a hackage library, which I have downloaded in my haskell folder. I can 'toggle' between both my personal .hs and the library but I cannot use them both at the same time. The library is Primes(just for clarity). How can I merge these two so I can continue my training?

2) Is there a way to see a function if you call it in winGCHI. I don't mean the type structure which you do with :t but really the function itself for instance(see bold):

circular_times :: Int -> [Int]
circular_times n = take (length (show n)) (iterate circular n)


thanks in advance.

best,

Alexander 

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: using both my personal .hs and a library simultaneously + seeing a function

Ut Primum
Hi,

1) I'm not sure this is what you are looking for, but you could import the module Primes (write "import Primes" at the beginning) in your .hs script, so when loading the script you would load also Primes.

Another way:
:load yourFile.hs
:module +Primes

2) you can try with
:list circular_times
(This should print the line where the word "circular_times" appears for the first time, the line before and after it)

Best,
Ut

Il gio 30 gen 2020, 14:29 Alexander Chen <[hidden email]> ha scritto:
Hi,

1) I have my own functions in a .hs file which i can load in winGCHI and use the functions without a problem. But I also need 1 function from a hackage library, which I have downloaded in my haskell folder. I can 'toggle' between both my personal .hs and the library but I cannot use them both at the same time. The library is Primes(just for clarity). How can I merge these two so I can continue my training?

2) Is there a way to see a function if you call it in winGCHI. I don't mean the type structure which you do with :t but really the function itself for instance(see bold):

circular_times :: Int -> [Int]
circular_times n = take (length (show n)) (iterate circular n)


thanks in advance.

best,

Alexander 
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: using both my personal .hs and a library simultaneously + seeing a function

Norbert Melzer
In reply to this post by Alexander Chen
On Thu, Jan 30, 2020 at 2:29 PM Alexander Chen <[hidden email]> wrote:
Hi,

1) I have my own functions in a .hs file which i can load in winGCHI and use the functions without a problem. But I also need 1 function from a hackage library, which I have downloaded in my haskell folder. I can 'toggle' between both my personal .hs and the library but I cannot use them both at the same time. The library is Primes(just for clarity). How can I merge these two so I can continue my training?

Do you use a stack or cabal project or a plain file collection?

For a stack or cabal project you need to properly define it as a dependency, for plain files I'm not quite sure how it works, but I'd experiment with the `-i` argument to adjust the search path.
 
 
2) Is there a way to see a function if you call it in winGCHI. I don't mean the type structure which you do with :t but really the function itself for instance(see bold):

circular_times :: Int -> [Int]
circular_times n = take (length (show n)) (iterate circular n)

Not that I am aware off.
 


thanks in advance.

best,

Alexander 
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners