Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/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.  Implementation question about directed acyclic   graph
      (Christian Sperandio)
   2. Re:  Implementation question about directed acyclic graph
      (Benjamin Edwards)
   3. Re:  Creating modules (Alexey Shmalko)
   4.  Import issue (Shishir Srivastava)
   5. Re:  Import issue (Brandon Allbery)


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

Message: 1
Date: Fri, 8 May 2015 15:30:56 +0200
From: Christian Sperandio <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Implementation question about directed
        acyclic graph
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

Hi,

I?m learning the Bayesian networks and I want to write my own implementation.
So, I started implementing t a DAG in Haskell but I?ve got some questions about 
the best way to do it in a functional mind.

I?m thinking about a DAG implementation avoids duplicate information. So, I 
imagined this implementation:

data Node a = Node { event :: a, proved :: Bool, nodeID :: Int }

type Connections = M.Map Int [Int]

data Graph a = Empty
             | Gragh { nodes :: M.Map Int (Node a), nextID :: Int, connections 
:: Connections }



My idea is to yield an ID for each node and use this ID for connections. Thus, 
I can have the same events connected many times without duplicate the event 
data.
And when I have to change a node state, I don?t need to search all occurrences 
in the graph.

Am I on the right  way ?

Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150508/e800861c/attachment-0001.html>

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

Message: 2
Date: Fri, 08 May 2015 14:02:30 +0000
From: Benjamin Edwards <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Implementation question about
        directed acyclic graph
Message-ID:
        <can6k4njraynv3sihcwfovjzz-k3l4rhcnwx1e5fj09hzq08...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Having a look at how graphs are implemented in fgl might be helpful to you.

Ben

On Fri, 8 May 2015 at 14:31 Christian Sperandio <
[email protected]> wrote:

> Hi,
>
> I?m learning the Bayesian networks and I want to write my own
> implementation.
> So, I started implementing t a DAG in Haskell but I?ve got some questions
> about the best way to do it in a functional mind.
>
> I?m thinking about a DAG implementation avoids duplicate information. So,
> I imagined this implementation:
>
> data Node a = Node { event :: a, proved :: Bool, nodeID :: Int }
>
> type Connections = M.Map Int [Int]
>
> data Graph a = Empty
>              | Gragh { nodes :: M.Map Int (Node a), nextID :: Int,
> connections :: Connections }
>
>
>
> My idea is to yield an ID for each node and use this ID for connections.
> Thus, I can have the same events connected many times without duplicate the
> event data.
> And when I have to change a node state, I don?t need to search all
> occurrences in the graph.
>
> Am I on the right  way ?
>
> Chris
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150508/8bb9971c/attachment-0001.html>

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

Message: 3
Date: Fri, 8 May 2015 18:47:24 +0300
From: Alexey Shmalko <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Creating modules
Message-ID:
        <cafc2pc6a3jui5wdfnd7ob39cvwka0tx9j98ygc9cnmbk7_e...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Just a quick note. When you compile (or load in ghci) your Main
module, GHC is smart enough to find other modules it import without
further help. So usually you won't care about compiling/recompiling
distinct modules, only the whole program.

On Fri, May 8, 2015 at 2:05 PM, Dananji Liyanage <[email protected]> wrote:
> Thank you very much :)
>
> On Fri, May 8, 2015 at 4:31 PM, Magnus Therning <[email protected]> wrote:
>>
>> On 8 May 2015 at 12:53, Dananji Liyanage <[email protected]> wrote:
>> > Thanks Magnus!!
>> >
>> > Got it to working.
>>
>> Excellent!  I can recommend reading the ghc docs[1], they are good and
>> very readable.  Then peruse Hackage to find examples of how things
>> work.
>>
>> /M
>>
>> [1]:
>> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/index.html
>>
>> --
>> Magnus Therning                      OpenPGP: 0xAB4DFBA4
>> email: [email protected]   jabber: [email protected]
>> twitter: magthe               http://therning.org/magnus
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
>
>
> --
> Regards,
> Dananji Liyanage
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>


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

Message: 4
Date: Fri, 8 May 2015 19:25:10 +0100
From: Shishir Srivastava <[email protected]>
To: beginners <[email protected]>
Subject: [Haskell-beginners] Import issue
Message-ID:
        <CALe5RTu=b0BrTu5gDbLOos0h-qSTQA+q_JUdy5y6TomPr6OD=g...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,

I've imported the State monad module and used in the 'pop' function that
will pop the head out of the list but am getting error in GHCi.

-----
import Control.Monad.State
let pop = State $ \(x:xs) -> (x,xs)

<interactive>:73:11:
    Not in scope: data constructor ?State?
    Perhaps you meant ?StateT? (imported from Control.Monad.State)
-----

Please can anyone point out what the issue is here?

Thanks,
Shishir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150508/2748df8e/attachment-0001.html>

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

Message: 5
Date: Fri, 8 May 2015 14:36:53 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Import issue
Message-ID:
        <CAKFCL4WKT5V6x1bD6=2qlta80tk8mr0kth7pbkuaq1_m9nb...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Fri, May 8, 2015 at 2:25 PM, Shishir Srivastava <
[email protected]> wrote:

> I've imported the State monad module and used in the 'pop' function that
> will pop the head out of the list but am getting error in GHCi.
>

You are probably working from outdated documentation of some kind. The
original standalone monads like State from mtl1 were replaced several years
ago with type aliases (in this case `type State s a = StateT s Identity a`)
in mtl2, which means State is no longer a constructor. The `state` function
can be used as a quick replacement for the old `State` constructor for any
purpose other than pattern matching.

-- 
brandon s allbery kf8nh                               sine nomine associates
[email protected]                                  [email protected]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150508/914f43d0/attachment-0001.html>

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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 83, Issue 11
*****************************************

Reply via email to