Skip to content
This repository has been archived by the owner on Jan 17, 2020. It is now read-only.

combine MountF and MountConfig #86

Open
safareli opened this issue Nov 8, 2017 · 5 comments
Open

combine MountF and MountConfig #86

safareli opened this issue Nov 8, 2017 · 5 comments

Comments

@safareli
Copy link
Contributor

safareli commented Nov 8, 2017

data MountF f
  = View (f FilePath)
  | ..

data MountConfig
  = ViewConfig View.Config
  | ..

This ^ could be combined into:

data MountF f g
  = View (f FilePath)  (g View.Config)

then:

type MountConfig = MountF (Const Unit) Identity
type Mount = MountF Identity (Const Unit)
type MountType = MountF (Const Unit) (Const Unit)
@safareli
Copy link
Contributor Author

This way CreateMount AbsPath MountConfig will change to CreateMount (MountF Identity Identity)

@kritzcreek
Copy link
Contributor

What's the benefit of more and more indirection?

@garyb
Copy link
Member

garyb commented Feb 27, 2018

This change would ensure that the path you use to create a mount is appropriate for the type of mount: currently you can try to mount a view on a directory path, a connection on a file path, etc.

Well, a change along these lines, I'm not sure on the specific implementation, but I mentioned about using the types to do this to Irakli which is why he commented on it again just now.

@safareli
Copy link
Contributor Author

safareli commented Feb 27, 2018

We would be able to express all this types with just one MountF:

type CreateMountConfig = MountF Identity Identity
type MountConfig = MountF (Const Unit) Identity
type Mount = MountF Identity (Const Unit)
type MountType = MountF (Const Unit) (Const Unit)

This way it's more clear and fun :D

type On = Identity
type Off = Const Unit

type CreateMountConfig = MountF On  On
type MountConfig       = MountF Off On
type Mount             = MountF On  Off
type MountType         = MountF Off Off

@safareli
Copy link
Contributor Author

Related change #104

We could change Resource to ResourceF (like for MountF) and have deleteResource and moveResource instead of moveData, MoveMount, etc.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants