text: Q:
  
  Is it great to make classes as functions, and declare parameters type with function types?
  
  I'm working on a scala project, and my colleague who prefers functional style and proposes a way to organize code: Define classes as functions
  Here is a sample:
  class FetchFeed extends (String => List[Feed]) {
     def apply(url:String):List[Feed] = ???
  }
  
  When other class needs this class, it will be declared using the type String => List[Feed]
  class MyWork(fetchFeed: String => List[Feed])
  
  Then in some place, pass a FetchFeed to it:
  val fetchFeed = new FetchFeed
  val myWork = new MyWork(fetchFeed)
  
  The pros is that we can easily mock the FetchFeed by passing a function:
  val myWork = new MyWork(_ => List(new Feed))
  
  The syntax is simple and easy to read. 
  But the cons is that, when I see the declaration of MyWork:
  class MyWork(fetchFeed: String => List[Feed])
  
  It's hard to see which class will be passed in, even the IDE can't help me. We need to search extends (String => List[Feed]) in the codebase, or find the place to initialize the new MyWork.
  And if there is another class which extends String => List[Feed] but which is never used in MyWork, it often will confuse me.
  But if we declare it with the real type:
  class MyWork(fetchFeed: FetchFeed)
  
  It will be easier to jump to the declarations directly. But with this case, we can't pass functions directly, instead, we need to:
  val fetchFeed = mock[FetchFeed]
  fetchFeed.apply(any[String]) returns List(new Feed)
  
  val myWork = new MyWork(fetchFeed)
  
  I'm struggling with the two solutions. Is it a common pattern like this when write code in functional style?  Is there any open-source projects take this style that I can get some ideas from?
  
  A:
  
  The style you described is not common partially because of the issues you mentioned. If your trying to achieve a functional style, you would be better off just using functions with type aliases.
  // Alias the function type to a meaningful name
  type FetchFeed = String => List[Feed]
  
  // Declaring an implementation
  val fetchFeed: FetchFeed = url => ...
  
  // Nice type name to work with
  class MyWork(fetchFeed: FetchFeed)
  
  // Declaring a mock is still easy
  new MyWork(_ => List(new Feed))
  
  